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;
13 public static ContactListI newContactList(ContactListProviderI list)
15 return new ContactListImpl(list);
18 public ContactListImpl(ContactListProviderI list)
24 public int getPosition()
26 return clist.getPosition();
30 public double getContactAt(int column)
32 return clist.getContactAt(column);
36 public int getContactHeight()
38 return clist.getContactHeight();
42 public ContactRange getRangeFor(int from_column, int to_column)
44 if (clist instanceof ContactListI)
46 // clist may implement getRangeFor in a more efficient way, so use theirs
47 return ((ContactListI) clist).getRangeFor(from_column, to_column);
53 if (to_column > getContactHeight())
55 to_column = getContactHeight();
57 ContactRange cr = new ContactRange();
58 cr.setFrom_column(from_column);
59 cr.setTo_column(to_column);
61 for (int i = from_column; i <= to_column; i++)
63 double contact = getContactAt(i);
74 if (cr.getMax() < contact)
79 if (cr.getMin() < contact)
88 cr.setMean(tot / (1 + to_column - from_column));