.findAncestorForm(BeamGroupForm.class, chordGroupForm);
if (ancestorBeam != null) {
stemDirUp = ancestorBeam.isStemDirUp();
}
ConcurrentSkipListSet<Integer> posYLocationSet = new ConcurrentSkipListSet<Integer>();
NoteForm highestNote = null;
Point highestLocation = null;
NoteForm lowestNote = null;
Point lowestLocation = null;
for (BasicElement child : MeiNodeNavigator.findActiveDescendantForm(
NoteForm.class, chordGroupForm)) {
NoteForm noteForm = (NoteForm) child;
boolean noteHeadRight = false;
Point noteHeadCenterLocation = calculateNoteHeadLocation(noteForm,
location);
if (highestNote == null) {
highestNote = noteForm;
highestLocation = noteHeadCenterLocation;
} else {
if (noteHeadCenterLocation.y > highestLocation.y) {
highestNote = noteForm;
highestLocation = noteHeadCenterLocation;
}
}
if (lowestNote == null) {
lowestNote = noteForm;
lowestLocation = noteHeadCenterLocation;
} else {
if (noteHeadCenterLocation.y < lowestLocation.y) {
lowestNote = noteForm;
lowestLocation = noteHeadCenterLocation;
}
}
if (posYLocationSet.contains(noteHeadCenterLocation.y + 2)
|| posYLocationSet.contains(noteHeadCenterLocation.y + 3)
|| posYLocationSet.contains(noteHeadCenterLocation.y - 2)
|| posYLocationSet.contains(noteHeadCenterLocation.y - 3)) {
noteHeadRight = true;
}
posYLocationSet.add(noteHeadCenterLocation.y);
processNote(graphics, noteForm, location, noteHeadRight);
}
// draw flag if not in a beam
NoteForm noteClosestToFlagInChord;
NoteForm noteFarthestFromFlagInChord;
if (chordGroupForm.getChildren().size() > 1) {
if (stemDirUp) {
noteClosestToFlagInChord = highestNote;
noteFarthestFromFlagInChord = lowestNote;
} else {