apply gpl development license
[jalview.git] / src / jalview / datamodel / Annotation.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
3  * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18  */
19 package jalview.datamodel;
20
21 import java.awt.*;
22
23 /**
24  * DOCUMENT ME!
25  * 
26  * @author $author$
27  * @version $Revision$
28  */
29 public class Annotation
30 {
31   /** DOCUMENT ME!! */
32   public String displayCharacter = "";
33
34   /** DOCUMENT ME!! */
35   public String description = ""; // currently used as mouse over
36
37   /** DOCUMENT ME!! */
38   public char secondaryStructure = ' '; // recognises H and E
39
40   /** DOCUMENT ME!! */
41   public float value;
42
43   // add visual cues here
44
45   /** DOCUMENT ME!! */
46   public Color colour;
47
48   /**
49    * Creates a new Annotation object.
50    * 
51    * @param displayChar
52    *                DOCUMENT ME!
53    * @param desc
54    *                DOCUMENT ME!
55    * @param ss
56    *                DOCUMENT ME!
57    * @param val
58    *                DOCUMENT ME!
59    */
60   public Annotation(String displayChar, String desc, char ss, float val)
61   {
62     displayCharacter = displayChar;
63     description = desc;
64     secondaryStructure = ss;
65     value = val;
66   }
67
68   /**
69    * Creates a new Annotation object.
70    * 
71    * @param displayChar
72    *                DOCUMENT ME!
73    * @param desc
74    *                DOCUMENT ME!
75    * @param ss
76    *                DOCUMENT ME!
77    * @param val
78    *                DOCUMENT ME!
79    * @param colour
80    *                DOCUMENT ME!
81    */
82   public Annotation(String displayChar, String desc, char ss, float val,
83           Color colour)
84   {
85     this(displayChar, desc, ss, val);
86     this.colour = colour;
87   }
88
89   /**
90    * Copy constructor New annotation takes on the same (or duplicated)
91    * attributes as the given template
92    * 
93    * @param that
94    *                template annotation
95    */
96   public Annotation(Annotation that)
97   {
98     if (that == null || this == that)
99     {
100       return;
101     }
102     if (that.displayCharacter != null)
103       displayCharacter = new String(that.displayCharacter);
104     if (that.description != null)
105       description = new String(that.description);
106     secondaryStructure = that.secondaryStructure;
107     value = that.value;
108     colour = that.colour;
109   }
110
111   /**
112    * Value only annotation.
113    * 
114    * @param val
115    *                value at this annotation position
116    */
117   public Annotation(float val)
118   {
119     this(null, null, ' ', val);
120   }
121 }