JAL-4090 JAL-1551 spotlessApply
[jalview.git] / src / jalview / datamodel / ContactListImpl.java
index b71c4b7..7cd9dc9 100644 (file)
@@ -1,5 +1,7 @@
 package jalview.datamodel;
 
+import java.awt.Color;
+
 import jalview.renderer.ContactGeometry.contactInterval;
 
 /**
@@ -53,9 +55,9 @@ public class ContactListImpl implements ContactListI
     {
       from_column = 0;
     }
-    if (to_column > getContactHeight())
+    if (to_column >= getContactHeight())
     {
-      to_column = getContactHeight();
+      to_column = getContactHeight() - 1;
     }
     ContactRange cr = new ContactRange();
     cr.setFrom_column(from_column);
@@ -86,7 +88,7 @@ public class ContactListImpl implements ContactListI
         }
       }
     }
-    if (tot > 0)
+    if (tot > 0 && to_column > from_column)
     {
       cr.setMean(tot / (1 + to_column - from_column));
     }
@@ -96,9 +98,16 @@ public class ContactListImpl implements ContactListI
     }
     return cr;
   }
+
   @Override
   public int[] getMappedPositionsFor(int cStart, int cEnd)
   {
-    return     clist.getMappedPositionsFor(cStart, cEnd);
+    return clist.getMappedPositionsFor(cStart, cEnd);
+  }
+
+  @Override
+  public Color getColourForGroup()
+  {
+    return clist.getColourForGroup();
   }
 }