}
}
- public Collection<SequenceFeature> getFeatures()
- {
- return features;
- }
-
/**
* Answers a list of all either positional or non-positional features whose
* feature group matches the given group (which may be null)
*/
if (nonPositionalFeatures != null)
{
- List<SequenceFeature> list = nonPositionalFeatures;
- for (int i = 0, n = list.size(); i < n; i++)
+ for (int i = 0, n = nonPositionalFeatures.size(); i < n; i++)
{
- SequenceFeature sf = list.get(i);
+ SequenceFeature sf = nonPositionalFeatures.get(i);
nonPositionalFeatureGroups.add(sf.getFeatureGroup());
float score = sf.getScore();
nonPositionalMinScore = min(nonPositionalMinScore, score);
}
}
- /*
- * scan positional features for groups, scores and extents
- */
-
rescanPositional(contactFeatureStarts);
rescanPositional(features);
}
+ /**
+ * Scans the given features and updates cached feature groups, minimum and
+ * maximum feature score, and total feature extent (length) for positional
+ * features
+ *
+ * @param sfs
+ */
private void rescanPositional(Collection<SequenceFeature> sfs)
{
if (sfs == null)
import jalview.datamodel.features.FeatureStore.IntervalStoreType;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.Set;
import org.testng.annotations.Test;
+import junit.extensions.PA;
+
/**
* Tests that exercise the 'linked list' version of IntervalStore
*/
assertEquals(fs.getFeatureCount(true), 3);
assertTrue(fs.delete(sf1));
assertEquals(fs.getFeatureCount(true), 2);
- assertEquals(fs.getFeatures().size(), 2);
+ Collection<SequenceFeature> intervalStore = (Collection<SequenceFeature>) PA
+ .getValue(fs, "features");
+ assertEquals(intervalStore.size(), 2);
assertFalse(fs.isEmpty());
assertTrue(fs.delete(sf2));
assertEquals(fs.getFeatureCount(true), 1);
assertEquals(features.size(), 2);
assertTrue(features.contains(sf1));
assertTrue(features.contains(sf2));
- assertTrue(store.getFeatures().contains(sf1));
- assertTrue(store.getFeatures().contains(sf2));
+ Collection<SequenceFeature> intervalStore = (Collection<SequenceFeature>) PA
+ .getValue(store, "features");
+ assertTrue(intervalStore.contains(sf1));
+ assertTrue(intervalStore.contains(sf2));
/*
* delete the first feature
import jalview.datamodel.features.FeatureStore.IntervalStoreType;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.Set;
import org.testng.annotations.Test;
+import junit.extensions.PA;
+
/**
* Tests that exercise the 'NC array' implementation of IntervalStore
*/
assertEquals(fs.getFeatureCount(true), 3);
assertTrue(fs.delete(sf1));
assertEquals(fs.getFeatureCount(true), 2);
- assertEquals(fs.getFeatures().size(), 2);
+ Collection<SequenceFeature> intervalStore = (Collection<SequenceFeature>) PA
+ .getValue(fs, "features");
+ assertEquals(intervalStore.size(), 2);
assertFalse(fs.isEmpty());
assertTrue(fs.delete(sf2));
assertEquals(fs.getFeatureCount(true), 1);
assertEquals(features.size(), 2);
assertTrue(features.contains(sf1));
assertTrue(features.contains(sf2));
- assertTrue(store.getFeatures().contains(sf1));
- assertTrue(store.getFeatures().contains(sf2));
+ Collection<SequenceFeature> intervalStore = (Collection<SequenceFeature>) PA
+ .getValue(store, "features");
+ assertTrue(intervalStore.contains(sf1));
+ assertTrue(intervalStore.contains(sf2));
/*
* delete the first feature
import jalview.datamodel.SequenceFeature;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.Set;
import org.testng.annotations.Test;
+import junit.extensions.PA;
+
public class FeatureStoreTest
{
private FeatureStore newFeatureStore()
assertEquals(fs.getFeatureCount(true), 3);
assertTrue(fs.delete(sf1));
assertEquals(fs.getFeatureCount(true), 2);
- assertEquals(fs.getFeatures().size(), 2);
+ Collection<SequenceFeature> intervalStore = (Collection<SequenceFeature>) PA
+ .getValue(fs, "features");
+ assertEquals(intervalStore.size(), 2);
assertFalse(fs.isEmpty());
assertTrue(fs.delete(sf2));
assertEquals(fs.getFeatureCount(true), 1);
assertEquals(features.size(), 2);
assertTrue(features.contains(sf1));
assertTrue(features.contains(sf2));
- assertTrue(store.getFeatures().contains(sf1));
- assertTrue(store.getFeatures().contains(sf2));
+ Collection<SequenceFeature> intervalStore = (Collection<SequenceFeature>) PA
+ .getValue(store, "features");
+ assertTrue(intervalStore.contains(sf1));
+ assertTrue(intervalStore.contains(sf2));
/*
* delete the first feature