+ * noSort leaves sort order unchanged, within sequence- and
+ * non-sequence-related annotations, but may switch the ordering of these
+ * groups. Note this is guaranteed (at least in Java 7) as Arrays.sort() is
+ * guaranteed to be 'stable' (not change ordering of equal items).
+ */
+ private Comparator<? super AlignmentAnnotation> noSort = new Comparator<AlignmentAnnotation>()
+ {
+ @Override
+ public int compare(AlignmentAnnotation o1, AlignmentAnnotation o2)
+ {
+ if (o1 != null && o2 != null)
+ {
+ if (o1.sequenceRef == null && o2.sequenceRef != null)
+ {
+ return showAutocalcAbove ? -1 : 1;
+ }
+ if (o1.sequenceRef != null && o2.sequenceRef == null)
+ {
+ return showAutocalcAbove ? 1 : -1;
+ }
+ }
+ return 0;
+ }
+ };
+
+ /**
+ * Sort by the specified ordering of sequence-specific annotations.