GPL license added
[jalview.git] / src / jalview / schemes / ConservationColourScheme.java
index 0a68682..8c3f694 100755 (executable)
@@ -1,88 +1,88 @@
-/* Jalview - a java multiple alignment editor
- * Copyright (C) 1998  Michele Clamp
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-package jalview.schemes;
-import java.awt.*;
-import jalview.gui.*;
-import jalview.datamodel.*;
-import jalview.analysis.*;
-import java.util.Vector;
-
-public class ConservationColourScheme extends ResidueColourScheme {
-  public Conservation conserve;
-  public ColourSchemeI cs;
-  public int inc = 30;
-
-  public ConservationColourScheme(Conservation cons, ColourSchemeI oldcs)
-  {
-    super();
-    conserve = cons;
-    cs = oldcs;
-  }
-
-  public void setConsensus(Vector consensus)
-  {
-    this.consensus = consensus;
-    cs.setConsensus(consensus);
-  }
-
-   public Color findColour(String s, int i)
-   {
-     Color c = Color.white;
-     if (cs == null)
-       return c;
-
-     char ch = conserve.getConsSequence().getSequence().charAt(i);
-     if (ch == '*' || ch == '+')
-     {
-       c = cs.findColour(s, i);
-     }
-     else
-     {
-       int tmp = 10;
-       int t = 0;
-       if (!jalview.util.Comparison.isGap(ch))
-         t = Integer.parseInt(ch + "");
-
-       c = cs.findColour(s, i);
-
-       while (tmp >= t)
-       {
-         c = lighter(c, inc);
-         tmp--;
-       }
-
-     }
-
-   return c;
-   }
-
-
-  public Color lighter(Color c, int inc) {
-    int red = c.getRed();
-    int blue = c.getBlue();
-    int green = c.getGreen();
-
-    if (red < 255-inc) { red = red +inc;} else {red = 255;}
-    if (blue < 255-inc) { blue = blue +inc;} else {blue = 255;}
-    if (green < 255-inc) { green = green +inc;} else {green = 255;}
-
-    return new Color(red,green,blue);
-  }
-
-}
+/*\r
+* Jalview - A Sequence Alignment Editor and Viewer\r
+* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+*\r
+* This program is free software; you can redistribute it and/or\r
+* modify it under the terms of the GNU General Public License\r
+* as published by the Free Software Foundation; either version 2\r
+* of the License, or (at your option) any later version.\r
+*\r
+* This program is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with this program; if not, write to the Free Software\r
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+*/\r
+\r
+package jalview.schemes;\r
+import java.awt.*;\r
+import jalview.analysis.*;\r
+import java.util.Vector;\r
+\r
+public class ConservationColourScheme extends ResidueColourScheme {\r
+  public Conservation conserve;\r
+  public ColourSchemeI cs;\r
+  public int inc = 30;\r
+\r
+  public ConservationColourScheme(Conservation cons, ColourSchemeI oldcs)\r
+  {\r
+    super();\r
+    conserve = cons;\r
+    cs = oldcs;\r
+  }\r
+\r
+  public void setConsensus(Vector consensus)\r
+  {\r
+    this.consensus = consensus;\r
+    if(cs!=null)\r
+      cs.setConsensus(consensus);\r
+  }\r
+\r
+   public Color findColour(String s, int i)\r
+   {\r
+     Color c = Color.white;\r
+     if (cs == null)\r
+       return c;\r
+\r
+     char ch = conserve.getConsSequence().getSequence().charAt(i);\r
+     if (ch == '*' || ch == '+')\r
+     {\r
+       c = cs.findColour(s, i);\r
+     }\r
+     else\r
+     {\r
+       int tmp = 10;\r
+       int t = 0;\r
+       if (!jalview.util.Comparison.isGap(ch))\r
+         t = Integer.parseInt(ch + "");\r
+\r
+       c = cs.findColour(s, i);\r
+\r
+       while (tmp >= t)\r
+       {\r
+         c = lighter(c, inc);\r
+         tmp--;\r
+       }\r
+\r
+     }\r
+\r
+   return c;\r
+   }\r
+\r
+\r
+  public Color lighter(Color c, int inc) {\r
+    int red = c.getRed();\r
+    int blue = c.getBlue();\r
+    int green = c.getGreen();\r
+\r
+    if (red < 255-inc) { red = red +inc;} else {red = 255;}\r
+    if (blue < 255-inc) { blue = blue +inc;} else {blue = 255;}\r
+    if (green < 255-inc) { green = green +inc;} else {green = 255;}\r
+\r
+    return new Color(red,green,blue);\r
+  }\r
+\r
+}\r