question: private static boolean isAppropriateDevice ( MidiDevice device , Class deviceClass , boolean allowSynthesizer , boolean allowSequencer ) { if ( deviceClass . isInstance ( device ) ) { return true ; } else { if ( ( ! ( device instanceof Sequencer ) && ! ( device instanceof Synthesizer ) ) || ( ( device instanceof Sequencer ) && allowSequencer ) || ( ( device instanceof Synthesizer ) && allowSynthesizer ) ) { if ( ( deviceClass == Receiver . class && device . getMaxReceivers ( ) != 0 ) || ( deviceClass == Transmitter . class && device . getMaxTransmitters ( ) != 0 ) ) { return true ; } } } return false ; }
target:  Checks if a MidiDevice is appropriate. If deviceClass is Synthesizer or Sequencer, a device implementing the respective interface is considered appropriate. If deviceClass is Receiver or Transmitter, a device is considered appropriate if it implements neither Synthesizer nor Transmitter, and if it can provide at least one Receiver or Transmitter, respectively.