1 package jalview.datamodel;
4 * helper class to compute min/max/mean for a range on a contact list
9 public class ContactListImpl implements ContactListI
11 ContactListProviderI clist;
14 public static ContactListI newContactList(ContactListProviderI list)
16 return new ContactListImpl(list);
19 public ContactListImpl(ContactListProviderI list)
25 public double getContactAt(int column)
27 return clist.getContactAt(column);
31 public int getContactHeight()
33 return clist.getContactHeight();
37 public ContactRange getRangeFor(int from_column, int to_column)
39 if (clist instanceof ContactListI)
41 // clist may implement getRangeFor in a more efficient way, so use theirs
42 return ((ContactListI) clist).getRangeFor(from_column, to_column);
48 if (to_column > getContactHeight())
50 to_column = getContactHeight();
52 ContactRange cr = new ContactRange();
53 cr.setFrom_column(from_column);
54 cr.setTo_column(to_column);
56 for (int i = from_column; i < to_column; i++)
58 double contact = getContactAt(i);
69 if (cr.getMax() < contact)
74 if (cr.getMin() < contact)
83 cr.setMean(tot / (to_column - from_column));