JAL-3621 update to intervalstore v1.1
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 18 May 2020 14:57:13 +0000 (15:57 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 27 Jul 2020 15:13:29 +0000 (16:13 +0100)
j11lib/intervalstore-v1.0.jar [deleted file]
j11lib/intervalstore-v1.1.jar [new file with mode: 0644]
j8lib/intervalstore-v1.0.jar [deleted file]
j8lib/intervalstore-v1.1.jar [new file with mode: 0644]
src/jalview/datamodel/features/FeatureStore.java
src/jalview/datamodel/features/SequenceFeatures.java

diff --git a/j11lib/intervalstore-v1.0.jar b/j11lib/intervalstore-v1.0.jar
deleted file mode 100644 (file)
index 4f6101c..0000000
Binary files a/j11lib/intervalstore-v1.0.jar and /dev/null differ
diff --git a/j11lib/intervalstore-v1.1.jar b/j11lib/intervalstore-v1.1.jar
new file mode 100644 (file)
index 0000000..668b543
Binary files /dev/null and b/j11lib/intervalstore-v1.1.jar differ
diff --git a/j8lib/intervalstore-v1.0.jar b/j8lib/intervalstore-v1.0.jar
deleted file mode 100644 (file)
index 4f6101c..0000000
Binary files a/j8lib/intervalstore-v1.0.jar and /dev/null differ
diff --git a/j8lib/intervalstore-v1.1.jar b/j8lib/intervalstore-v1.1.jar
new file mode 100644 (file)
index 0000000..668b543
Binary files /dev/null and b/j8lib/intervalstore-v1.1.jar differ
index 54c0d59..7651016 100644 (file)
@@ -20,8 +20,6 @@
  */
 package jalview.datamodel.features;
 
-import jalview.datamodel.SequenceFeature;
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
@@ -30,7 +28,9 @@ import java.util.Set;
 
 import intervalstore.api.IntervalStoreI;
 import intervalstore.impl.BinarySearcher;
+import intervalstore.impl.BinarySearcher.Compare;
 import intervalstore.impl.IntervalStore;
+import jalview.datamodel.SequenceFeature;
 
 /**
  * A data store for a set of sequence features that supports efficient lookup of
@@ -277,7 +277,7 @@ public class FeatureStore
      * binary search the sorted list to find the insertion point
      */
     int insertPosition = BinarySearcher.findFirst(contactFeatureStarts,
-            f -> f.getBegin() >= feature.getBegin());
+            true, Compare.GE, feature.getBegin());
     contactFeatureStarts.add(insertPosition, feature);
 
 
@@ -286,7 +286,7 @@ public class FeatureStore
      * binary search the sorted list to find the insertion point
      */
     insertPosition = BinarySearcher.findFirst(contactFeatureEnds,
-            f -> f.getEnd() >= feature.getEnd());
+            false, Compare.GE, feature.getEnd());
     contactFeatureEnds.add(insertPosition, feature);
 
     return true;
@@ -314,8 +314,8 @@ public class FeatureStore
      */
     // int pos = binarySearch(features,
     // SearchCriterion.byFeature(feature, RangeComparator.BY_START_POSITION));
-    int pos = BinarySearcher.findFirst(features,
-            val -> val.getBegin() >= feature.getBegin());
+    int pos = BinarySearcher.findFirst(features, true, Compare.GE,
+            feature.getBegin());
     int len = features.size();
     while (pos < len)
     {
@@ -396,7 +396,7 @@ public class FeatureStore
      * whose end point is not before the target range
      */
     int index = BinarySearcher.findFirst(contactFeatureEnds,
-            f -> f.getEnd() >= from);
+            false, Compare.GE, (int) from);
 
     while (index < contactFeatureEnds.size())
     {
@@ -449,7 +449,7 @@ public class FeatureStore
           List<SequenceFeature> result)
   {
     int index = BinarySearcher.findFirst(contactFeatureStarts,
-            f -> f.getBegin() >= from);
+            true, Compare.GE, (int) from);
 
     while (index < contactFeatureStarts.size())
     {
index db2f0e1..70485b6 100644 (file)
  */
 package jalview.datamodel.features;
 
-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.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -33,6 +30,9 @@ import java.util.Set;
 import java.util.TreeMap;
 
 import intervalstore.api.IntervalI;
+import jalview.datamodel.SequenceFeature;
+import jalview.io.gff.SequenceOntologyFactory;
+import jalview.io.gff.SequenceOntologyI;
 
 /**
  * A class that stores sequence features in a way that supports efficient
@@ -44,7 +44,6 @@ import intervalstore.api.IntervalI;
  */
 public class SequenceFeatures implements SequenceFeaturesI
 {
-
   /*
    * map from feature type to structured store of features for that type
    * null types are permitted (but not a good idea!)
@@ -414,7 +413,9 @@ public class SequenceFeatures implements SequenceFeaturesI
   public static void sortFeatures(List<? extends IntervalI> features,
           final boolean forwardStrand)
   {
-    IntervalI.sortIntervals(features, forwardStrand);
+    Collections.sort(features,
+            forwardStrand ? IntervalI.COMPARE_BEGIN_ASC_END_ASC
+                    : IntervalI.COMPARE_END_DESC);
   }
 
   /**