JAL-1140 - IO classes should only raise generic IOExceptions
[jalview.git] / src / jalview / datamodel / Annotation.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.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
43
44   // add visual cues here
45
46   /** DOCUMENT ME!! */
47   public Color colour;
48
49   /**
50    * Creates a new Annotation object.
51    * 
52    * @param displayChar
53    *          DOCUMENT ME!
54    * @param desc
55    *          DOCUMENT ME!
56    * @param ss
57    *          DOCUMENT ME!
58    * @param val
59    *          DOCUMENT ME!
60    */
61   public Annotation(String displayChar, String desc, char ss, float val)
62   {
63     displayCharacter = displayChar;
64     description = desc;
65     secondaryStructure = ss;
66     value = val;
67     
68   }
69
70   /**
71    * Creates a new Annotation object.
72    * 
73    * @param displayChar
74    *          DOCUMENT ME!
75    * @param desc
76    *          DOCUMENT ME!
77    * @param ss
78    *          DOCUMENT ME!
79    * @param val
80    *          DOCUMENT ME!
81    * @param colour
82    *          DOCUMENT ME!
83    */
84   public Annotation(String displayChar, String desc, char ss, float val,
85           Color colour)
86   {
87     this(displayChar, desc, ss, val);
88     this.colour = colour;
89   }
90
91   /**
92    * Copy constructor New annotation takes on the same (or duplicated)
93    * attributes as the given template
94    * 
95    * @param that
96    *          template annotation
97    */
98   public Annotation(Annotation that)
99   {
100     if (that == null || this == that)
101     {
102       return;
103     }
104     if (that.displayCharacter != null)
105       displayCharacter = new String(that.displayCharacter);
106     if (that.description != null)
107       description = new String(that.description);
108     secondaryStructure = that.secondaryStructure;
109     value = that.value;
110     colour = that.colour;
111
112   }
113
114   /**
115    * Value only annotation.
116    * 
117    * @param val
118    *          value at this annotation position
119    */
120   public Annotation(float val)
121   {
122     this(null, null, ' ', val,null);
123   }
124   
125   
126   
127   
128 }