code: public void setMiddleNote(Note n) {
  		//same note has middle, maybe with octave
  		byte strictHeight = n.getStrictHeight();
  		boolean set = false;
  		if (strictHeight == getMiddleNote().getStrictHeight()) {
  			set = true;
  		} else {
  			//some accepted cases
  			Clef[] toCompare = null;
  			if (isG()) {
  				toCompare = new Clef[] { TREBLE, FRENCH_VIOLIN };
  			} else if (isF()) {
  				toCompare = new Clef[] { BASS, BARITONE };
  			} else if (isC()) {
  				toCompare = new Clef[] { SOPRANO, MEZZOSOPRANO, ALTO, TENOR };
  			}
  			if (toCompare != null) {
                  for (Clef aToCompare : toCompare) {
                      if (strictHeight == aToCompare.getMiddleNote().getStrictHeight()) {
                          m_lineNumber = (byte) aToCompare.getLineNumber();
                          set = true;
                          break;
                      }
                  }
  			}
  			//Accept any note as middle
  			if (isPerc()) {
  				set = true;
  			}
  		}
  		if (set) {
  			//if linenumber has changed, recompute middle note
  			reset();
  			//compute invisible octave transposition
  			m_invisibleOctaveTransp =
  				(byte)(n.getOctaveTransposition()
  					- getMiddleNote().getOctaveTransposition());
  			m_middleNote = n;
  			reset();
  		}
  	}
docs: Sets the middle note (for an "internal" octave
  transposition, if Note n is compatible with predefined
  middle note.
  
  e.g. middle note for bass is <TT>D,</TT> accepts <TT>D</TT> or <TT>d</TT>
  but will reject all other notes