From: gmungoc Date: Mon, 18 May 2020 14:57:13 +0000 (+0100) Subject: JAL-3621 update to intervalstore v1.1 X-Git-Tag: Release_2_11_1_1~22^2~10 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=bdfc8f264a9670d38e2185e21cda7c57f611d9af;p=jalview.git JAL-3621 update to intervalstore v1.1 --- diff --git a/j11lib/intervalstore-v1.0.jar b/j11lib/intervalstore-v1.0.jar deleted file mode 100644 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 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 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 index 0000000..668b543 Binary files /dev/null and b/j8lib/intervalstore-v1.1.jar differ diff --git a/src/jalview/datamodel/features/FeatureStore.java b/src/jalview/datamodel/features/FeatureStore.java index 54c0d59..7651016 100644 --- a/src/jalview/datamodel/features/FeatureStore.java +++ b/src/jalview/datamodel/features/FeatureStore.java @@ -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 result) { int index = BinarySearcher.findFirst(contactFeatureStarts, - f -> f.getBegin() >= from); + true, Compare.GE, (int) from); while (index < contactFeatureStarts.size()) { diff --git a/src/jalview/datamodel/features/SequenceFeatures.java b/src/jalview/datamodel/features/SequenceFeatures.java index db2f0e1..70485b6 100644 --- a/src/jalview/datamodel/features/SequenceFeatures.java +++ b/src/jalview/datamodel/features/SequenceFeatures.java @@ -20,11 +20,8 @@ */ 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 features, final boolean forwardStrand) { - IntervalI.sortIntervals(features, forwardStrand); + Collections.sort(features, + forwardStrand ? IntervalI.COMPARE_BEGIN_ASC_END_ASC + : IntervalI.COMPARE_END_DESC); } /**