X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2Ffeatures%2FSequenceFeatures.java;h=cb2b8cc1f13d483ec592adbca3b3e045aefe3d60;hb=80634498762666e6acc92368716bf1a4d4f42f7b;hp=54102ceaf28952bc9848b2c0cfe9fe919ccbd6a1;hpb=5fa443fd521570a00ce85a627761582adad2bfd4;p=jalview.git diff --git a/src/jalview/datamodel/features/SequenceFeatures.java b/src/jalview/datamodel/features/SequenceFeatures.java index 54102ce..cb2b8cc 100644 --- a/src/jalview/datamodel/features/SequenceFeatures.java +++ b/src/jalview/datamodel/features/SequenceFeatures.java @@ -53,7 +53,31 @@ public class SequenceFeatures implements SequenceFeaturesI */ private Map featureStore; - private static boolean useIntervalStore = !Platform.isJS(); + /** + * original NCList-based IntervalStore + */ + private final static int INTERVAL_STORE_NCLIST = 0; + + /** + * linked-list deferred-sort IntervalStore - experimental only; unused + */ + private final static int INTERVAL_STORE_LINKED_LIST_NO_PRESORT = 1; + + /** + * linked-list IntervalStore option for JavaScript + */ + private final static int INTERVAL_STORE_LINKED_LIST = -1; + + /** + * mode for Java or JavaScript; can be set differently for testing, but + * default is LINKED_LIST for JalviewJS and NCLIST for Java + */ + private final int INTERVAL_STORE_MODE = ( + // true || // + Platform.isJS() ? // + INTERVAL_STORE_LINKED_LIST // + : INTERVAL_STORE_NCLIST// + ); /** * Constructor @@ -106,8 +130,16 @@ public class SequenceFeatures implements SequenceFeaturesI private FeatureStoreI newFeatureStore() { - // TODO Auto-generated method stub - return (useIntervalStore ? new FeatureStoreImpl() : new FeatureStoreJS()); + switch (INTERVAL_STORE_MODE) + { + default: + case INTERVAL_STORE_NCLIST: + return new FeatureStoreImpl(true); + case INTERVAL_STORE_LINKED_LIST_NO_PRESORT: + return new FeatureStoreImpl(false); + case INTERVAL_STORE_LINKED_LIST: + return new FeatureStoreJS(); + } } /** @@ -120,6 +152,10 @@ public class SequenceFeatures implements SequenceFeaturesI List result = new ArrayList<>(); for (FeatureStoreI featureSet : varargToTypes(type)) { + // System.err.println("SF findFeature " + System.currentTimeMillis() + // + " " + from + " " + to + " " + // + featureSet.getPositionalFeatures().get(0).type); + // result.addAll(featureSet.findOverlappingFeatures(from, to, null)); } return result; @@ -160,8 +196,8 @@ public class SequenceFeatures implements SequenceFeaturesI return new ArrayList<>(); } - return getAllFeatures(featureTypes.toArray(new String[featureTypes - .size()])); + return getAllFeatures( + featureTypes.toArray(new String[featureTypes.size()])); } /** @@ -226,7 +262,6 @@ public class SequenceFeatures implements SequenceFeaturesI return featureStore.values(); } - List types = new ArrayList<>(); List args = Arrays.asList(type); for (Entry featureType : featureStore.entrySet()) @@ -329,8 +364,8 @@ public class SequenceFeatures implements SequenceFeaturesI for (Entry featureType : featureStore.entrySet()) { - Set featureGroups = featureType.getValue().getFeatureGroups( - positionalFeatures); + Set featureGroups = featureType.getValue() + .getFeatureGroups(positionalFeatures); for (String group : groups) { if (featureGroups.contains(group)) @@ -398,8 +433,9 @@ public class SequenceFeatures implements SequenceFeaturesI @Override public float getMinimumScore(String type, boolean positional) { - return featureStore.containsKey(type) ? featureStore.get(type) - .getMinimumScore(positional) : Float.NaN; + return featureStore.containsKey(type) + ? featureStore.get(type).getMinimumScore(positional) + : Float.NaN; } /** @@ -408,8 +444,9 @@ public class SequenceFeatures implements SequenceFeaturesI @Override public float getMaximumScore(String type, boolean positional) { - return featureStore.containsKey(type) ? featureStore.get(type) - .getMaximumScore(positional) : Float.NaN; + return featureStore.containsKey(type) + ? featureStore.get(type).getMaximumScore(positional) + : Float.NaN; } /** @@ -523,8 +560,6 @@ public class SequenceFeatures implements SequenceFeaturesI // Platform: timer mark 52.355 0.185 overviewrender 16000 pixels row:14 // Platform: timer mark 53.829 0.186 overviewrender 16000 pixels row:14 - - /** * @author Bob Hanson 2019.08.01 */