JAL-2349 adjusted range calculation to be inclusive rather than inclusive, exclusive...
[jalview.git] / src / jalview / datamodel / ContactListImpl.java
index 6eb4cdb..561048e 100644 (file)
@@ -10,7 +10,6 @@ public class ContactListImpl implements ContactListI
 {
   ContactListProviderI clist;
 
-
   public static ContactListI newContactList(ContactListProviderI list)
   {
     return new ContactListImpl(list);
@@ -53,7 +52,7 @@ public class ContactListImpl implements ContactListI
     cr.setFrom_column(from_column);
     cr.setTo_column(to_column);
     double tot = 0;
-    for (int i = from_column; i < to_column; i++)
+    for (int i = from_column; i <= to_column; i++)
     {
       double contact = getContactAt(i);
       tot += contact;
@@ -80,7 +79,7 @@ public class ContactListImpl implements ContactListI
     }
     if (tot > 0)
     {
-      cr.setMean(tot / (to_column - from_column));
+      cr.setMean(tot / (1 + to_column - from_column));
     }
     else
     {