X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FAlignmentSorter.java;h=c4436ebf9721419eba5ced2a4aba4daa725cf14b;hb=12fdd79d25527a93ee20ffa562899ec5b703e4d5;hp=bb554262f5674bcedb5382c9b978602e7077d93c;hpb=a4a68a8b10217312efe5f2ea4746f1cfc9da155d;p=jalview.git diff --git a/src/jalview/analysis/AlignmentSorter.java b/src/jalview/analysis/AlignmentSorter.java index bb55426..c4436eb 100755 --- a/src/jalview/analysis/AlignmentSorter.java +++ b/src/jalview/analysis/AlignmentSorter.java @@ -40,6 +40,10 @@ import jalview.util.*; */ public class AlignmentSorter { + /** + * todo: refactor searches to follow a basic pattern: + * (search property, last search state, current sort direction) + */ static boolean sortIdAscending = true; static int lastGroupHash = 0; @@ -58,11 +62,12 @@ public class AlignmentSorter * last Annotation Label used by sortByScore */ private static String lastSortByScore; - + private static boolean sortByScoreAscending = true; /** * compact representation of last arguments to SortByFeatureScore */ private static String lastSortByFeatureScore; + private static boolean sortByFeatureScoreAscending = true; private static boolean sortLengthAscending; @@ -361,7 +366,7 @@ public class AlignmentSorter private static SequenceI[] vectorSubsetToArray(Vector tmp, Vector mask) { Vector seqs = new Vector(); - int i; + int i,idx; boolean[] tmask = new boolean[mask.size()]; for (i = 0; i < mask.size(); i++) @@ -372,10 +377,10 @@ public class AlignmentSorter for (i = 0; i < tmp.size(); i++) { Object sq = tmp.elementAt(i); - - if (mask.contains(sq) && tmask[mask.indexOf(sq)]) + idx = mask.indexOf(sq); + if (idx>-1 && tmask[idx]) { - tmask[mask.indexOf(sq)] = false; + tmask[idx] = false; seqs.addElement(sq); } } @@ -719,7 +724,7 @@ public class AlignmentSorter boolean ignoreScore=method!=FEATURE_SCORE; StringBuffer scoreLabel = new StringBuffer(); scoreLabel.append(start+stop+method); - // This doesn't work yet - we'd like to have a canonical ordering that can be preserved from call to call + // This doesn't quite work yet - we'd like to have a canonical ordering that can be preserved from call to call for (int i=0;featureLabels!=null && i