JAL-3253-applet JAL-3397
authorhansonr <hansonr@STO24954W.ad.stolaf.edu>
Sun, 22 Sep 2019 16:35:42 +0000 (12:35 -0400)
committerhansonr <hansonr@STO24954W.ad.stolaf.edu>
Sun, 22 Sep 2019 16:35:42 +0000 (12:35 -0400)
fixing CrossRef equals broken by reversion of changes relating to
equalsInterval.

adds equalsWithParent

src/intervalstore/nonc/IntervalStore0Impl.java
src/intervalstore/nonc/IntervalStoreImpl.java
src/jalview/analysis/CrossRef.java
src/jalview/datamodel/SequenceFeature.java

index dd925c6..ffcb722 100644 (file)
@@ -74,7 +74,7 @@ public class IntervalStore0Impl<T> extends IntervalStore0
   boolean sameInterval(IntervalI i1, IntervalI i2)
   {
     // avoiding equals() for JavaScript performance
-    return ((SequenceFeature) i1).equals((SequenceFeature) i2, false);
+    return ((SequenceFeature) i1).equalsWithParent((SequenceFeature) i2);
   }
 
 }
index 7cc5f1b..8456b7f 100644 (file)
@@ -70,7 +70,8 @@ public class IntervalStoreImpl<T> extends IntervalStore
   protected boolean sameInterval(IntervalI i1, IntervalI i2)
   {
     // avoiding equals() for JavaScript performance
-    return ((SequenceFeature) i1).equals((SequenceFeature) i2, false);
+    // could be CrossRef with ignoreParent==true
+    return ((SequenceFeature) i1).equalsWithParent((SequenceFeature) i2);
   }
 
 }
index 1ab8a24..ed87f05 100644 (file)
@@ -37,8 +37,6 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import intervalstore.api.IntervalI;
-
 /**
  * Functions for cross-referencing sequence databases.
  * 
@@ -643,20 +641,20 @@ public class CrossRef
                     // equals, because that is part of the IntervalI interface,
                     // and IntervalStore may need that for proper, faster
                     // processing.
-                    // @Override
-                    // public boolean equals(Object o)
-                    // {
-                    // return super.equals(o, true);
-                    // }
-                    //
+                    // But SequenceFeature changes were reverted...
                     @Override
-                    public boolean equalsInterval(IntervalI sf)
+                    public boolean equals(Object o)
                     {
-                      return sf != null
-                              && equals((SequenceFeature) sf, true);
+                      return o instanceof SequenceFeature
+                              && equalsWithParent((SequenceFeature) o);
                     }
-                  };
 
+                    @Override
+                    public boolean equalsWithParent(SequenceFeature sf)
+                    {
+                      return sf != null && equals(sf, true);
+                    }
+                  };
                   matched.addSequenceFeature(newFeature);
                 }
               }
index bf0b996..1af23a4 100755 (executable)
@@ -217,8 +217,20 @@ public class SequenceFeature implements FeatureLocationI
   @Override
   public boolean equals(Object o)
   {
-    return (o != null && (o instanceof SequenceFeature)
-            && equals(((SequenceFeature) o), false));
+    return (o instanceof SequenceFeature
+            && equalsWithParent((SequenceFeature) o));
+  }
+
+  /**
+   * BH 2019.09.22 required due to subclassing by CrossRef and used by
+   * intervalstore.nonc.IntervalStoreImpl
+   * 
+   * @param sf
+   * @return
+   */
+  public boolean equalsWithParent(SequenceFeature sf)
+  {
+    return equals(sf, false);
   }
 
   /**