JAL-3253-applet JAL-3397 JAL-3383 fast IntervalStore for JavaScript
[jalview.git] / src / jalview / datamodel / SequenceFeature.java
index a71c7b1..6f51420 100755 (executable)
@@ -102,16 +102,6 @@ public class SequenceFeature implements FeatureLocationI
   private String source;
 
   /**
-   * 1-based index into the featureList used by FeatureStoreJS
-   */
-  public int index1;
-
-  /**
-   * containment nesting link used by FeatureStoreJS to track starting points
-   */
-  public SequenceFeature containedBy;
-
-  /**
    * Constructs a duplicate feature. Note: Uses makes a shallow copy of the
    * otherDetails map, so the new and original SequenceFeature may reference the
    * same objects in the map.
@@ -229,10 +219,20 @@ public class SequenceFeature implements FeatureLocationI
   @Override
   public boolean equals(Object o)
   {
-    return equals(o, false);
+    return (o != null && (o instanceof SequenceFeature)
+            && equalsInterval((SequenceFeature) o));
   }
 
   /**
+   * Having determined that this is in fact a SequenceFeature, now check it for
+   * equivalence. Overridden in CrossRef; used by IntervalStore (possibly).
+   */
+  @Override
+  public boolean equalsInterval(IntervalI sf)
+  {
+    return equals((SequenceFeature) sf, false);
+  }
+  /**
    * Overloaded method allows the equality test to optionally ignore the
    * 'Parent' attribute of a feature. This supports avoiding adding many
    * superficially duplicate 'exon' or CDS features to genomic or protein
@@ -242,14 +242,8 @@ public class SequenceFeature implements FeatureLocationI
    * @param ignoreParent
    * @return
    */
-  public boolean equals(Object o, boolean ignoreParent)
+  public boolean equals(SequenceFeature sf, boolean ignoreParent)
   {
-    if (o == null || !(o instanceof SequenceFeature))
-    {
-      return false;
-    }
-
-    SequenceFeature sf = (SequenceFeature) o;
     boolean sameScore = Float.isNaN(score) ? Float.isNaN(sf.score)
             : score == sf.score;
     if (begin != sf.begin || end != sf.end || !sameScore)
@@ -749,19 +743,7 @@ public class SequenceFeature implements FeatureLocationI
     source = theSource;
   }
 
-  @Override
-  public IntervalI getContainedBy()
-  {
-    return containedBy;
-  }
-
-  @Override
-  public void setContainedBy(IntervalI containedBy)
-  {
-    this.containedBy = (SequenceFeature) containedBy;
-
-  }
-
 }
 
 class SFSortByEnd implements Comparator<SequenceFeature>