JAL-4134 column grouping model and methods moved to their own object held by by Conta...
[jalview.git] / src / jalview / datamodel / ContactMatrix.java
index 1b1889e..8f0afdf 100644 (file)
@@ -150,20 +150,6 @@ public abstract class ContactMatrix implements ContactMatrixI
   }
 
   @Override
-  public boolean hasReferenceSeq()
-  {
-    // TODO Auto-generated method stub
-    return false;
-  }
-
-  @Override
-  public SequenceI getReferenceSeq()
-  {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
   public String getAnnotLabel()
   {
     return "Contact Matrix";
@@ -174,53 +160,18 @@ public abstract class ContactMatrix implements ContactMatrixI
   {
     return "Contact Matrix";
   }
-  List<BitSet> groups=null;
-  @Override
-  public void updateGroups(List<BitSet> colGroups)
-  {
-    groups = colGroups;
-    colorMap=new HashMap<>();
-  }
+  GroupSet grps = new GroupSet();
   @Override
-  public boolean hasGroups()
+  public GroupSetI getGroupSet()
   {
-    return groups!=null && groups.size()>0;
+    return grps;
   }
   @Override
-  public List<BitSet> getGroups()
+  public void setGroupSet(GroupSet makeGroups)
   {
-    return groups;
-  }
-  @Override
-  public BitSet getGroupsFor(int column)
-  {
-    for (BitSet gp:groups) {
-      if (gp.get(column))
-      {
-        return gp;
-      }
-    }
-    return ContactMatrixI.super.getGroupsFor(column);
-  }
-  HashMap<BitSet,Color> colorMap = new HashMap<>();
-  @Override 
-  public Color getColourForGroup(BitSet bs)
-  {
-    if (bs==null) {
-      return Color.white;
-    }
-    Color groupCol=colorMap.get(bs);
-    if (groupCol==null)
-    {
-      return Color.white;
-    }
-    return groupCol;
-  }
-  @Override 
-  public void setColorForGroup(BitSet bs,Color color)
-  {
-    colorMap.put(bs,color);
+    grps = makeGroups;
   }
+
   public static String contactToFloatString(ContactMatrixI cm)
   {
     StringBuilder sb = new StringBuilder();