}
/**
+ * Add a contact feature to the lists that hold them ordered by start (first
+ * contact) and by end (second contact) position, ensuring the lists remain
+ * ordered, and returns true. This method allows duplicate features to be
+ * added, so test before calling to avoid this.
+ *
+ * @param feature
+ * @return
+ */
+ @Override
+ protected synchronized boolean addContactFeature(SequenceFeature feature)
+ {
+ if (contactFeatureStarts == null)
+ {
+ contactFeatureStarts = new ArrayList<>();
+ contactFeatureEnds = new ArrayList<>();
+ }
+ contactFeatureStarts.add(
+ findFirstBegin(contactFeatureStarts, feature.begin), feature);
+ contactFeatureEnds.add(findFirstEnd(contactFeatureEnds, feature.end),
+ feature);
+ return true;
+ }
+
+ /**
* Returns a (possibly empty) list of features whose extent overlaps the given
* range. The returned list is not ordered. Contact features are included if
* either of the contact points lies within the range.
}
}
- public static int findFirstBegin(List<SequenceFeature> list, long pos)
+ @Override
+ protected int findFirstBegin(List<SequenceFeature> list, long pos)
{
int start = 0;
int end = list.size() - 1;
return matched;
}
- public static int findFirstEnd(List<SequenceFeature> list, long pos)
+ @Override
+ protected int findFirstEnd(List<SequenceFeature> list, long pos)
{
int start = 0;
int end = list.size() - 1;