Merge branch 'feature/JAL-3127_seqidChainshading' into merge/JAL-3127
[jalview.git] / src / jalview / schemes / CovariationColourScheme.java
index ee78317..dc7971b 100644 (file)
  */
 package jalview.schemes;
 
+import jalview.api.AlignViewportI;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AnnotatedCollectionI;
-import jalview.datamodel.SequenceCollectionI;
-import jalview.datamodel.SequenceI;
+import jalview.util.ColorUtils;
 
 import java.awt.Color;
 import java.util.Hashtable;
@@ -37,9 +37,9 @@ import java.util.Map;
  */
 public class CovariationColourScheme extends ResidueColourScheme
 {
-  public Hashtable helixcolorhash = new Hashtable();
+  public Map<String, Color> helixcolorhash = new Hashtable<>();
 
-  public Hashtable positionsToHelix = new Hashtable();
+  public Map<Integer, String> positionsToHelix = new Hashtable<>();
 
   int numHelix = 0;
 
@@ -50,8 +50,8 @@ public class CovariationColourScheme extends ResidueColourScheme
    * be coloured
    */
   @Override
-  public ColourSchemeI getInstance(AnnotatedCollectionI coll,
-          Map<SequenceI, SequenceCollectionI> hrs)
+  public ColourSchemeI getInstance(AlignViewportI view,
+          AnnotatedCollectionI coll)
   {
     return new CovariationColourScheme(coll.getAlignmentAnnotation()[0]);
   }
@@ -76,18 +76,19 @@ public class CovariationColourScheme extends ResidueColourScheme
       positionsToHelix.put(this.annotation._rnasecstr[x].getEnd(),
               this.annotation._rnasecstr[x].getFeatureGroup());
 
-      if (Integer.parseInt(this.annotation._rnasecstr[x].getFeatureGroup()) > numHelix)
+      if (Integer.parseInt(
+              this.annotation._rnasecstr[x].getFeatureGroup()) > numHelix)
       {
-        numHelix = Integer.parseInt(this.annotation._rnasecstr[x]
-                .getFeatureGroup());
+        numHelix = Integer
+                .parseInt(this.annotation._rnasecstr[x].getFeatureGroup());
       }
 
     }
 
     for (int j = 0; j <= numHelix; j++)
     {
-      helixcolorhash.put(Integer.toString(j),
-              jalview.util.ColorUtils.generateRandomColor(Color.white));
+      helixcolorhash.put(String.valueOf(j),
+              ColorUtils.generateRandomColor(Color.white));
     }
 
   }
@@ -124,12 +125,12 @@ public class CovariationColourScheme extends ResidueColourScheme
     Color currentColour = Color.white;
     String currentHelix = null;
     // System.out.println(c + " " + j);
-    currentHelix = (String) positionsToHelix.get(j);
+    currentHelix = positionsToHelix.get(j);
     // System.out.println(positionsToHelix.get(j));
 
     if (currentHelix != null)
     {
-      currentColour = (Color) helixcolorhash.get(currentHelix);
+      currentColour = helixcolorhash.get(currentHelix);
     }
 
     // System.out.println(c + " " + j + " helix " + currentHelix + " " +
@@ -148,4 +149,10 @@ public class CovariationColourScheme extends ResidueColourScheme
   {
     return "Covariation";
   }
+
+  @Override
+  public boolean isSimple()
+  {
+    return false;
+  }
 }