JAL-1432 updated copyright notices
[jalview.git] / src / jalview / schemes / NucleotideColourScheme.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3  * Copyright (C) 2014 The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
10  *  
11  * Jalview is distributed in the hope that it will be useful, but 
12  * WITHOUT ANY WARRANTY; without even the implied warranty 
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14  * PURPOSE.  See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  * The Jalview Authors are detailed in the 'AUTHORS' file.
18  */
19 package jalview.schemes;
20
21 import jalview.datamodel.SequenceI;
22
23 import java.awt.Color;
24
25 /**
26  * DOCUMENT ME!
27  * 
28  * @author $author$
29  * @version $Revision$
30  */
31 public class NucleotideColourScheme extends ResidueColourScheme
32 {
33   /**
34    * Creates a new NucleotideColourScheme object.
35    */
36   public NucleotideColourScheme()
37   {
38     super(ResidueProperties.nucleotideIndex, ResidueProperties.nucleotide,
39             0);
40   }
41
42   /**
43    * DOCUMENT ME!
44    * 
45    * @param n
46    *          DOCUMENT ME!
47    * 
48    * @return DOCUMENT ME!
49    */
50   @Override
51   public Color findColour(char c)
52   {
53     // System.out.println("called"); log.debug
54     return colors[ResidueProperties.nucleotideIndex[c]];
55   }
56
57   /**
58    * DOCUMENT ME!
59    * 
60    * @param n
61    *          DOCUMENT ME!
62    * @param j
63    *          DOCUMENT ME!
64    * 
65    * @return DOCUMENT ME!
66    */
67   @Override
68   public Color findColour(char c, int j, SequenceI seq)
69   {
70     Color currentColour;
71     if ((threshold == 0) || aboveThreshold(c, j))
72     {
73       try
74       {
75         currentColour = colors[ResidueProperties.nucleotideIndex[c]];
76       } catch (Exception ex)
77       {
78         return Color.white;
79       }
80     }
81     else
82     {
83       return Color.white;
84     }
85
86     if (conservationColouring)
87     {
88       currentColour = applyConservation(currentColour, j);
89     }
90
91     return currentColour;
92   }
93 }