JAL-2490 performant findFeaturesAtRes
[jalview.git] / src / jalview / datamodel / Sequence.java
index 49caa4c..af6592b 100755 (executable)
@@ -321,6 +321,13 @@ public class Sequence extends ASequence implements SequenceI
   @Override
   public synchronized boolean addSequenceFeature(SequenceFeature sf)
   {
+    if (sf.getType() == null)
+    {
+      System.err.println("SequenceFeature type may not be null: "
+              + sf.toString());
+      return false;
+    }
+
     if (sequenceFeatures == null && datasetSequence != null)
     {
       return datasetSequence.addSequenceFeature(sf);
@@ -1178,6 +1185,8 @@ public class Sequence extends ASequence implements SequenceI
       // move features and database references onto dataset sequence
       dsseq.sequenceFeatures = sequenceFeatures;
       sequenceFeatures = null;
+      dsseq.sequenceFeatureStore = sequenceFeatureStore;
+      sequenceFeatureStore = null;
       dsseq.dbrefs = dbrefs;
       dbrefs = null;
       // TODO: search and replace any references to this sequence with
@@ -1497,13 +1506,17 @@ public class Sequence extends ASequence implements SequenceI
     }
   }
 
+  /**
+   * {@inheritDoc}
+   */
   @Override
-  public List<SequenceFeature> findFeatures(String type, int from, int to)
+  public List<SequenceFeature> findFeatures(int from, int to,
+          String... types)
   {
     if (datasetSequence != null)
     {
-      return datasetSequence.findFeatures(type, from, to);
+      return datasetSequence.findFeatures(from, to, types);
     }
-    return sequenceFeatureStore.findFeatures(from, to, type);
+    return sequenceFeatureStore.findFeatures(from, to, types);
   }
 }