- return true;
- }
- pos++;
- }
- return false;
- }
-
- abstract protected void findContactFeatures(long from, long to,
- List<SequenceFeature> result);
-
- /**
- * Answers a list of all positional features stored, in no guaranteed order
- *
- * @return
- */
-
- @Override
- public List<SequenceFeature> getPositionalFeatures(
- List<SequenceFeature> result)
- {
-
- /*
- * add any contact features - from the list by start position
- */
- if (contactFeatureStarts != null)
- {
- result.addAll(contactFeatureStarts);
- }
-
- /*
- * add any nested features
- */
- if (features != null)
- {
- result.addAll(features);
- }
-
- return result;
- }
-
- /**
- * Answers a list of all contact features. If there are none, returns an
- * immutable empty list.
- *
- * @return
- */
-
- @Override
- public List<SequenceFeature> getContactFeatures(
- List<SequenceFeature> result)
- {
- if (contactFeatureStarts != null)
- {
- result.addAll(contactFeatureStarts);
- }
- return result;
- }
-
- /**
- * Answers a list of all non-positional features. If there are none, returns
- * an immutable empty list.
- *
- * @return
- */
-
- @Override
- public List<SequenceFeature> getNonPositionalFeatures(
- List<SequenceFeature> result)
- {
- if (nonPositionalFeatures != null)
- {
- result.addAll(nonPositionalFeatures);
- }
- return result;
- }
-
- /**
- * Deletes the given feature from the store, returning true if it was found
- * (and deleted), else false. This method makes no assumption that the feature
- * is in the 'expected' place in the store, in case it has been modified since
- * it was added.
- *
- * @param sf
- */
-
- @Override
- public synchronized boolean delete(SequenceFeature sf)
- {
- boolean removed = false;
-
- /*
- * try contact positions (and if found, delete
- * from both lists of contact positions)
- */
- if (!removed && contactFeatureStarts != null)
- {
- removed = contactFeatureStarts.remove(sf);
- if (removed)
- {
- contactFeatureEnds.remove(sf);