git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-4090 figures in paematrix doc
[jalview.git]
/
src
/
jalview
/
datamodel
/
ContactListImpl.java
diff --git
a/src/jalview/datamodel/ContactListImpl.java
b/src/jalview/datamodel/ContactListImpl.java
index
6eb4cdb
..
7058ac7
100644
(file)
--- a/
src/jalview/datamodel/ContactListImpl.java
+++ b/
src/jalview/datamodel/ContactListImpl.java
@@
-1,5
+1,9
@@
package jalview.datamodel;
package jalview.datamodel;
+import java.awt.Color;
+
+import jalview.renderer.ContactGeometry.contactInterval;
+
/**
* helper class to compute min/max/mean for a range on a contact list
*
/**
* helper class to compute min/max/mean for a range on a contact list
*
@@
-10,7
+14,6
@@
public class ContactListImpl implements ContactListI
{
ContactListProviderI clist;
{
ContactListProviderI clist;
-
public static ContactListI newContactList(ContactListProviderI list)
{
return new ContactListImpl(list);
public static ContactListI newContactList(ContactListProviderI list)
{
return new ContactListImpl(list);
@@
-22,6
+25,12
@@
public class ContactListImpl implements ContactListI
}
@Override
}
@Override
+ public int getPosition()
+ {
+ return clist.getPosition();
+ }
+
+ @Override
public double getContactAt(int column)
{
return clist.getContactAt(column);
public double getContactAt(int column)
{
return clist.getContactAt(column);
@@
-36,6
+45,7
@@
public class ContactListImpl implements ContactListI
@Override
public ContactRange getRangeFor(int from_column, int to_column)
{
@Override
public ContactRange getRangeFor(int from_column, int to_column)
{
+ // TODO: consider caching ContactRange for a particular call ?
if (clist instanceof ContactListI)
{
// clist may implement getRangeFor in a more efficient way, so use theirs
if (clist instanceof ContactListI)
{
// clist may implement getRangeFor in a more efficient way, so use theirs
@@
-45,15
+55,15
@@
public class ContactListImpl implements ContactListI
{
from_column = 0;
}
{
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);
cr.setTo_column(to_column);
double tot = 0;
}
ContactRange cr = new ContactRange();
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;
{
double contact = getContactAt(i);
tot += contact;
@@
-78,9
+88,9
@@
public class ContactListImpl implements ContactListI
}
}
}
}
}
}
- if (tot > 0)
+ if (tot > 0 && to_column>from_column)
{
{
- cr.setMean(tot / (to_column - from_column));
+ cr.setMean(tot / (1 + to_column - from_column));
}
else
{
}
else
{
@@
-89,4
+99,15
@@
public class ContactListImpl implements ContactListI
return cr;
}
return cr;
}
+ @Override
+ public int[] getMappedPositionsFor(int cStart, int cEnd)
+ {
+ return clist.getMappedPositionsFor(cStart, cEnd);
+ }
+
+ @Override
+ public Color getColourForGroup()
+ {
+ return clist.getColourForGroup();
+ }
}
}