JAL-2106 corrections to DBRefEntry.isPrimary code and tests
[jalview.git] / src / jalview / datamodel / DBRefEntry.java
index e2ee195..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,6 +298,18 @@ public class DBRefEntry implements DBRefEntryI
       {
         return false;
       }
+      // 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;
+      }
     }
     if (version == null)
     {