JAL-2106 corrections to DBRefEntry.isPrimary code and tests
[jalview.git] / src / jalview / datamodel / DBRefEntry.java
index 11e77d8..143a4d2 100755 (executable)
@@ -23,6 +23,7 @@ package jalview.datamodel;
 import jalview.api.DBRefEntryI;
 
 import java.util.Arrays;
+import java.util.List;
 
 public class DBRefEntry implements DBRefEntryI
 {
@@ -297,12 +298,15 @@ public class DBRefEntry implements DBRefEntryI
       {
         return false;
       }
-      // check map is really 1:1, no shifts allowed.
-      if (map.getMap().getFromHighest() != map.getMap().getToHighest()
-              && map.getMap().getFromLowest() != map.getMap().getToLowest()
-              && !Arrays.equals(
-                      map.getMap().getFromRanges().toArray(new int[0][]),
-                      map.getMap().getToRanges().toArray(new int[0][])))
+      // check map is really 1:1, between identical single ranges
+      List<int[]> fromRanges = map.getMap().getFromRanges();
+      List<int[]> toRanges = map.getMap().getToRanges();
+      if (fromRanges.size() != 1 || toRanges.size() != 1)
+      {
+        return false;
+      }
+      if (fromRanges.get(0)[0] != toRanges.get(0)[0]
+              || fromRanges.get(0)[1] != toRanges.get(0)[1])
       {
         return false;
       }