X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FContactMatrixI.java;h=1d20987117ba409ebb79782c9453ca51acf03f19;hb=d4271d32477e99e9fbbfa5db3e11f1b79324e60d;hp=1d7391b617a009807695ac995693130c1c20e6dd;hpb=4b7d3640209c4434d569c746672cf9eed4250ace;p=jalview.git diff --git a/src/jalview/datamodel/ContactMatrixI.java b/src/jalview/datamodel/ContactMatrixI.java index 1d7391b..1d20987 100644 --- a/src/jalview/datamodel/ContactMatrixI.java +++ b/src/jalview/datamodel/ContactMatrixI.java @@ -14,10 +14,6 @@ public interface ContactMatrixI float getMax(); - boolean hasReferenceSeq(); - - SequenceI getReferenceSeq(); - String getAnnotDescr(); String getAnnotLabel(); @@ -31,29 +27,45 @@ public interface ContactMatrixI String getType(); int getWidth(); - int getHeight(); + public GroupSetI getGroupSet(); + + /// proxy methods to simplify use of the interface + /// Mappable contact matrices can override these to perform mapping + + default public boolean hasGroupSet() + { + return getGroupSet() != null; + } default boolean hasGroups() { - return false; + return hasGroupSet() && getGroupSet().hasGroups(); } default BitSet getGroupsFor(int column) { - BitSet colbitset = new BitSet(); - colbitset.set(column); - return colbitset; + if (!hasGroupSet()) + { + BitSet colbitset = new BitSet(); + colbitset.set(column); + return colbitset; + } + return getGroupSet().getGroupsFor(column); } default List getGroups() { - return Arrays.asList(); + if (!hasGroupSet()) + { + return Arrays.asList(); + } + return getGroupSet().getGroups(); } default boolean hasTree() { - return false; + return hasGroupSet() ? getGroupSet().hasTree() : false; } /** @@ -63,30 +75,51 @@ public interface ContactMatrixI */ default String getNewick() { - return null; + return hasGroupSet() ? getGroupSet().getNewick() : null; } default String getTreeMethod() { - return null; + return hasGroupSet() ? getGroupSet().getTreeMethod() : null; } default boolean hasCutHeight() { - return false; + return hasGroupSet() ? getGroupSet().hasCutHeight() : false; } default double getCutHeight() { - return 0; + return hasGroupSet() ? getGroupSet().getCutHeight() : 0; } - void updateGroups(List colGroups); + default void updateGroups(List colGroups) + { + if (hasGroupSet()) + { + getGroupSet().updateGroups(colGroups); + } + } - void setColorForGroup(BitSet bs, Color color); + default void setColorForGroup(BitSet bs, Color color) + { + if (hasGroupSet()) + { + getGroupSet().setColorForGroup(bs, color); + } + } default Color getColourForGroup(BitSet bs) { - return Color.white; - }; + if (hasGroupSet()) + { + return getGroupSet().getColourForGroup(bs); + } + else + { + return Color.white; + } + } + + void setGroupSet(GroupSet makeGroups); }