*/
public class AnnotationSorter
{
-
/**
* enum for annotation sort options. The text description is used in the
* Preferences drop-down options. The enum name is saved in the preferences
// working map of sequence index in alignment
private final Map<SequenceI, Integer> sequenceIndices = new HashMap<>();
+ // if true, sort only repositions auto-calculated annotation (to top or
+ // bottom)
+ private final boolean autocalcOnly;
+
/**
* Constructor given an alignment and the location (top or bottom) of
* Consensus and similar.
*
* @param alignmentI
* @param showAutocalculatedAbove
+ * @param autoCalcOnly
*/
public AnnotationSorter(AlignmentI alignmentI,
- boolean showAutocalculatedAbove)
+ boolean showAutocalculatedAbove, boolean autoCalcOnly)
{
this.alignment = alignmentI;
this.showAutocalcAbove = showAutocalculatedAbove;
+ this.autocalcOnly = autoCalcOnly;
}
/**
{
return showAutocalcAbove ? 1 : -1;
}
+ if (autocalcOnly)
+ {
+ return 0; // don't reorder other annotations
+ }
int sequenceOrder = compareSequences(o1, o2);
return sequenceOrder == 0 ? compareLabels(o1, o2) : sequenceOrder;
}
{
return showAutocalcAbove ? 1 : -1;
}
+ if (autocalcOnly)
+ {
+ return 0; // don't reorder other annotations
+ }
int labelOrder = compareLabels(o1, o2);
return labelOrder == 0 ? compareSequences(o1, o2) : labelOrder;
}