source formatting
[jalview.git] / src / jalview / schemes / RNAInteractionColourScheme.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3  * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
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  */
18  package jalview.schemes;
19
20 import jalview.datamodel.SequenceI;
21
22 import java.awt.Color;
23
24
25 public class RNAInteractionColourScheme extends ResidueColourScheme{
26          public RNAInteractionColourScheme()
27           {
28             super();
29           }
30
31           /**
32            * DOCUMENT ME!
33            * 
34            * @param n
35            *          DOCUMENT ME!
36            * 
37            * @return DOCUMENT ME!
38            */
39           @Override
40           public Color findColour(char c)
41           {
42             // System.out.println("called"); log.debug
43             return colors[ResidueProperties.nucleotideIndex[c]];
44           }
45
46           /**
47            * DOCUMENT ME!
48            * 
49            * @param n
50            *          DOCUMENT ME!
51            * @param j
52            *          DOCUMENT ME!
53            * 
54            * @return DOCUMENT ME!
55            */
56           @Override
57           public Color findColour(char c, int j, SequenceI seq)
58           {
59             Color currentColour;
60             if ((threshold == 0) || aboveThreshold(c, j))
61             {
62               try
63               {
64                 currentColour = colors[ResidueProperties.nucleotideIndex[c]];
65               } catch (Exception ex)
66               {
67                 return Color.white;
68               }
69             }
70             else
71             {
72               return Color.white;
73             }
74
75             if (conservationColouring)
76             {
77               currentColour = applyConservation(currentColour, j);
78             }
79
80             return currentColour;
81           }
82         }