v2
[jalview.git] / src / jalview / datamodel / Annotation.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3  * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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.datamodel;
19
20 import java.awt.*;
21 import java.util.ArrayList;
22
23 import fr.orsay.lri.varna.models.rna.RNA;
24
25 /**
26  * DOCUMENT ME!
27  * 
28  * @author $author$
29  * @version $Revision$
30  */
31 public class Annotation
32 {
33   /** DOCUMENT ME!! */
34   public String displayCharacter = "";
35
36   /** DOCUMENT ME!! */
37   public String description = ""; // currently used as mouse over
38
39   /** DOCUMENT ME!! */
40   public char secondaryStructure = ' '; // recognises H, E and S(?)
41
42   /** DOCUMENT ME!! */
43   public float value;
44   
45
46
47   // add visual cues here
48
49   /** DOCUMENT ME!! */
50   public Color colour;
51
52   /**
53    * Creates a new Annotation object.
54    * 
55    * @param displayChar
56    *          DOCUMENT ME!
57    * @param desc
58    *          DOCUMENT ME!
59    * @param ss
60    *          DOCUMENT ME!
61    * @param val
62    *          DOCUMENT ME!
63    */
64   public Annotation(String displayChar, String desc, char ss, float val)
65   {
66     displayCharacter = displayChar;
67     description = desc;
68     secondaryStructure = ss;
69     value = val;
70     
71   }
72
73   /**
74    * Creates a new Annotation object.
75    * 
76    * @param displayChar
77    *          DOCUMENT ME!
78    * @param desc
79    *          DOCUMENT ME!
80    * @param ss
81    *          DOCUMENT ME!
82    * @param val
83    *          DOCUMENT ME!
84    * @param colour
85    *          DOCUMENT ME!
86    */
87   public Annotation(String displayChar, String desc, char ss, float val,
88           Color colour)
89   {
90     this(displayChar, desc, ss, val);
91     this.colour = colour;
92   }
93
94   /**
95    * Copy constructor New annotation takes on the same (or duplicated)
96    * attributes as the given template
97    * 
98    * @param that
99    *          template annotation
100    */
101   public Annotation(Annotation that)
102   {
103     if (that == null || this == that)
104     {
105       return;
106     }
107     if (that.displayCharacter != null)
108       displayCharacter = new String(that.displayCharacter);
109     if (that.description != null)
110       description = new String(that.description);
111     secondaryStructure = that.secondaryStructure;
112     value = that.value;
113     colour = that.colour;
114
115   }
116
117   /**
118    * Value only annotation.
119    * 
120    * @param val
121    *          value at this annotation position
122    */
123   public Annotation(float val)
124   {
125     this(null, null, ' ', val,null);
126   }
127   
128   
129   
130   
131 }