package jalview.datamodel; import java.awt.Color; /** * Dummy contact matrix based on sequence distance * * @author jprocter * */ public class ContactMatrixTest implements ContactMatrixI { private int width = 0; public ContactMatrixTest(int width) { this.width = width; } @Override public ContactListI getContactList(final int column) { if (column<0 || column >= width) { return null; } return new ContactListI() { int p = column; @Override public Color getColorForScore(int column) { return jalview.util.ColorUtils.getGraduatedColour(Math.abs(column-p), 0, Color.white, width, Color.magenta); } @Override public Color getColorForRange(int from_column, int to_column) { return jalview.util.ColorUtils.getGraduatedColour( Math.abs(to_column + from_column - 2 * p) / 2, 0, Color.white, width, Color.magenta); } @Override public int getColumnWidth() { return 1; } @Override public int getContactHeight() { return width; } @Override public double getContactAt(int column) { return Math.abs(column - p); } }; } }