import intervalstore.api.IntervalStoreI;
import intervalstore.impl.BinarySearcher;
-import intervalstore.impl.IntervalStore;
/**
* A data store for a set of sequence features that supports efficient lookup of
public class FeatureStoreImpl extends FeatureStore
{
+ /**
+ * Default constructor uses NCList
+ */
public FeatureStoreImpl()
{
- features = new IntervalStore<>();
+ this(true);
+ }
+
+ public FeatureStoreImpl(boolean useNCList)
+ {
+ features = (useNCList ? new intervalstore.impl.IntervalStore<>()
+ : new intervalstore.nonc.IntervalStore<>(false));
}
/**
}
/**
+ * Adds one feature to the IntervalStore that can manage nested features
+ * (creating the IntervalStore if necessary)
+ */
+ @Override
+ protected synchronized boolean addPositionalFeature(
+ SequenceFeature feature)
+ {
+ return features.add(feature);
+ }
+
+ /**
* Adds contact features to the result list where either the second or the
* first contact position lies within the target range
*
}
}
+ @Override
+ protected boolean containsFeature(SequenceFeature feature)
+ {
+ return features.contains(feature);
+ }
+
/**
* Adds to the result list any contact features whose end (second contact
* point), but not start (first contact point), lies in the query from-to
return BinarySearcher.findFirst(list, f -> f.getEnd() >= pos);
}
+ @Override
+ protected boolean findAndRemoveNonContactFeature(SequenceFeature sf)
+ {
+ return features.remove(sf);
+ }
+
}