X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2Ffeatures%2FSequenceFeatures.java;h=db2f0e1bb9950587e78519087fc8232151d57425;hb=74393b51f368cb9f58589472d432a433d9c4386d;hp=1120291dcd3d6e78094b038f88f85555c8f512c8;hpb=7a0d503181fe41452120a8a02ca63476392aa08c;p=jalview.git diff --git a/src/jalview/datamodel/features/SequenceFeatures.java b/src/jalview/datamodel/features/SequenceFeatures.java index 1120291..db2f0e1 100644 --- a/src/jalview/datamodel/features/SequenceFeatures.java +++ b/src/jalview/datamodel/features/SequenceFeatures.java @@ -20,14 +20,11 @@ */ package jalview.datamodel.features; -import jalview.datamodel.ContiguousI; import jalview.datamodel.SequenceFeature; import jalview.io.gff.SequenceOntologyFactory; import jalview.io.gff.SequenceOntologyI; import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -35,6 +32,8 @@ import java.util.Map.Entry; import java.util.Set; import java.util.TreeMap; +import intervalstore.api.IntervalI; + /** * A class that stores sequence features in a way that supports efficient * querying by type and location (overlap). Intended for (but not limited to) @@ -45,29 +44,6 @@ import java.util.TreeMap; */ public class SequenceFeatures implements SequenceFeaturesI { - /** - * a comparator for sorting features by start position ascending - */ - private static Comparator FORWARD_STRAND = new Comparator() - { - @Override - public int compare(ContiguousI o1, ContiguousI o2) - { - return Integer.compare(o1.getBegin(), o2.getBegin()); - } - }; - - /** - * a comparator for sorting features by end position descending - */ - private static Comparator REVERSE_STRAND = new Comparator() - { - @Override - public int compare(ContiguousI o1, ContiguousI o2) - { - return Integer.compare(o2.getEnd(), o1.getEnd()); - } - }; /* * map from feature type to structured store of features for that type @@ -435,11 +411,10 @@ public class SequenceFeatures implements SequenceFeaturesI * @param features * @param forwardStrand */ - public static void sortFeatures(List features, + public static void sortFeatures(List features, final boolean forwardStrand) { - Collections.sort(features, forwardStrand ? FORWARD_STRAND - : REVERSE_STRAND); + IntervalI.sortIntervals(features, forwardStrand); } /**