import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import jalview.analysis.AnnotationSorter.SortOrder;
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.Sequence;
anns[6].sequenceRef = al.getSequenceAt(3); anns[6].label = "IRP";
// @formatter:on
- AnnotationSorter testee = new AnnotationSorter(al);
- testee.sort(anns, SortOrder.SEQUENCE_AND_TYPE);
+ AnnotationSorter testee = new AnnotationSorter(al, false);
+ testee.sort(anns, SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
assertEquals("label5", anns[0].label); // for sequence 0
assertEquals("label0", anns[1].label); // for sequence 1
assertEquals("iron", anns[2].label); // sequence 3 /iron
anns[6].sequenceRef = al.getSequenceAt(2); anns[6].label = "Structure";
// @formatter:on
- AnnotationSorter testee = new AnnotationSorter(al);
- testee.sort(anns, SortOrder.TYPE_AND_SEQUENCE);
+ AnnotationSorter testee = new AnnotationSorter(al, false);
+ testee.sort(anns, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
assertEquals("IRON", anns[0].label); // IRON / sequence 0
assertEquals("iron", anns[1].label); // iron / sequence 3
assertEquals("label0", anns[2].label); // label0 / sequence 1
anns[i].label = "label" + i;
}
long startTime = System.currentTimeMillis();
- AnnotationSorter testee = new AnnotationSorter(al);
- testee.sort(anns, SortOrder.TYPE_AND_SEQUENCE);
+ AnnotationSorter testee = new AnnotationSorter(al, false);
+ testee.sort(anns, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
long endTime = System.currentTimeMillis();
final long elapsed = endTime - startTime;
System.out.println("Timing test for presorted " + numSeqs
anns[i].label = "label" + i;
}
long startTime = System.currentTimeMillis();
- AnnotationSorter testee = new AnnotationSorter(al);
- testee.sort(anns, SortOrder.SEQUENCE_AND_TYPE);
+ AnnotationSorter testee = new AnnotationSorter(al, false);
+ testee.sort(anns, SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
long endTime = System.currentTimeMillis();
final long elapsed = endTime - startTime;
System.out.println("Timing test for unsorted " + numSeqs
anns[i].label = labels[r.nextInt(labels.length)];
}
long startTime = System.currentTimeMillis();
- AnnotationSorter testee = new AnnotationSorter(al);
- testee.sort(anns, SortOrder.TYPE_AND_SEQUENCE);
+ AnnotationSorter testee = new AnnotationSorter(al, false);
+ testee.sort(anns, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
long endTime = System.currentTimeMillis();
long elapsed = endTime - startTime;
System.out.println("Sort by type for semisorted " + numSeqs
// now resort by sequence
startTime = System.currentTimeMillis();
- testee.sort(anns, SortOrder.SEQUENCE_AND_TYPE);
+ testee.sort(anns, SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
endTime = System.currentTimeMillis();
elapsed = endTime - startTime;
System.out.println("Resort by sequence for semisorted " + numSeqs
// now resort by type
startTime = System.currentTimeMillis();
- testee.sort(anns, SortOrder.TYPE_AND_SEQUENCE);
+ testee.sort(anns, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
endTime = System.currentTimeMillis();
elapsed = endTime - startTime;
System.out.println("Resort by type for semisorted " + numSeqs