update author list in license for (JAL-826)
[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
22 /**
23  * DOCUMENT ME!
24  * 
25  * @author $author$
26  * @version $Revision$
27  */
28 public class Annotation
29 {
30   /** DOCUMENT ME!! */
31   public String displayCharacter = "";
32
33   /** DOCUMENT ME!! */
34   public String description = ""; // currently used as mouse over
35
36   /** DOCUMENT ME!! */
37   public char secondaryStructure = ' '; // recognises H, E and S(?)
38
39   /** DOCUMENT ME!! */
40   public float value;
41
42   // add visual cues here
43
44   /** DOCUMENT ME!! */
45   public Color colour;
46
47   /**
48    * Creates a new Annotation object.
49    * 
50    * @param displayChar
51    *          DOCUMENT ME!
52    * @param desc
53    *          DOCUMENT ME!
54    * @param ss
55    *          DOCUMENT ME!
56    * @param val
57    *          DOCUMENT ME!
58    */
59   public Annotation(String displayChar, String desc, char ss, float val)
60   {
61     displayCharacter = displayChar;
62     description = desc;
63     secondaryStructure = ss;
64     value = val;
65   }
66
67   /**
68    * Creates a new Annotation object.
69    * 
70    * @param displayChar
71    *          DOCUMENT ME!
72    * @param desc
73    *          DOCUMENT ME!
74    * @param ss
75    *          DOCUMENT ME!
76    * @param val
77    *          DOCUMENT ME!
78    * @param colour
79    *          DOCUMENT ME!
80    */
81   public Annotation(String displayChar, String desc, char ss, float val,
82           Color colour)
83   {
84     this(displayChar, desc, ss, val);
85     this.colour = colour;
86   }
87
88   /**
89    * Copy constructor New annotation takes on the same (or duplicated)
90    * attributes as the given template
91    * 
92    * @param that
93    *          template annotation
94    */
95   public Annotation(Annotation that)
96   {
97     if (that == null || this == that)
98     {
99       return;
100     }
101     if (that.displayCharacter != null)
102       displayCharacter = new String(that.displayCharacter);
103     if (that.description != null)
104       description = new String(that.description);
105     secondaryStructure = that.secondaryStructure;
106     value = that.value;
107     colour = that.colour;
108   }
109
110   /**
111    * Value only annotation.
112    * 
113    * @param val
114    *          value at this annotation position
115    */
116   public Annotation(float val)
117   {
118     this(null, null, ' ', val);
119   }
120 }