1 package jalview.datamodel;
3 import jalview.renderer.ContactGeometry.contactInterval;
6 * helper class to compute min/max/mean for a range on a contact list
11 public class ContactListImpl implements ContactListI
13 ContactListProviderI clist;
15 public static ContactListI newContactList(ContactListProviderI list)
17 return new ContactListImpl(list);
20 public ContactListImpl(ContactListProviderI list)
26 public int getPosition()
28 return clist.getPosition();
32 public double getContactAt(int column)
34 return clist.getContactAt(column);
38 public int getContactHeight()
40 return clist.getContactHeight();
44 public ContactRange getRangeFor(int from_column, int to_column)
46 // TODO: consider caching ContactRange for a particular call ?
47 if (clist instanceof ContactListI)
49 // clist may implement getRangeFor in a more efficient way, so use theirs
50 return ((ContactListI) clist).getRangeFor(from_column, to_column);
56 if (to_column > getContactHeight())
58 to_column = getContactHeight();
60 ContactRange cr = new ContactRange();
61 cr.setFrom_column(from_column);
62 cr.setTo_column(to_column);
64 for (int i = from_column; i <= to_column; i++)
66 double contact = getContactAt(i);
77 if (cr.getMax() < contact)
82 if (cr.getMin() < contact)
91 cr.setMean(tot / (1 + to_column - from_column));
100 public int[] getMappedPositionsFor(int cStart, int cEnd)
102 return clist.getMappedPositionsFor(cStart, cEnd);