import jalview.util.QuickSort;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
/**
int start, int stop, AlignmentI alignment, String method)
{
sortByFeature(featureLabel == null ? null
- : new String[] { featureLabel }, groupLabel == null ? null
- : new String[] { groupLabel }, start, stop, alignment, method);
+ : Arrays.asList(new String[] { featureLabel }),
+ groupLabel == null ? null
+ : Arrays.asList(new String[]{ groupLabel }), start, stop, alignment, method);
}
private static boolean containsIgnoreCase(final String lab,
- final String[] labs)
+ final List<String> labs)
{
if (labs == null)
{
{
return false;
}
- for (int q = 0; q < labs.length; q++)
+ for (String label : labs)
{
- if (labs[q] != null && lab.equalsIgnoreCase(labs[q]))
+ if (lab.equalsIgnoreCase(label))
{
return true;
}
return false;
}
- public static void sortByFeature(String[] featureLabels,
- String[] groupLabels, int start, int stop, AlignmentI alignment,
+ public static void sortByFeature(List<String> featureLabels,
+ List<String> groupLabels, int start, int stop, AlignmentI alignment,
String method)
{
if (method != FEATURE_SCORE && method != FEATURE_LABEL
scoreLabel.append(start + stop + method);
// 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 < featureLabels.length; i++)
+ if (featureLabels != null)
{
- scoreLabel.append(featureLabels[i] == null ? "null"
- : featureLabels[i]);
+ for (String label : featureLabels)
+ {
+ scoreLabel.append(label);
+ }
}
- for (int i = 0; groupLabels != null && i < groupLabels.length; i++)
+ if (groupLabels != null)
{
- scoreLabel.append(groupLabels[i] == null ? "null" : groupLabels[i]);
+ for (String label : groupLabels)
+ {
+ scoreLabel.append(label);
+ }
}
/*