otherDetails
[jalview.git] / src / jalview / datamodel / SequenceFeature.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer\r
3  * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
4  *\r
5  * This program is free software; you can redistribute it and/or\r
6  * modify it under the terms of the GNU General Public License\r
7  * as published by the Free Software Foundation; either version 2\r
8  * of the License, or (at your option) any later version.\r
9  *\r
10  * This program is distributed in the hope that it will be useful,\r
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13  * GNU General Public License for more details.\r
14  *\r
15  * You should have received a copy of the GNU General Public License\r
16  * along with this program; if not, write to the Free Software\r
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
18  */\r
19 package jalview.datamodel;\r
20 \r
21 import java.util.Hashtable;\r
22 \r
23 /**\r
24  * DOCUMENT ME!\r
25  *\r
26  * @author $author$\r
27  * @version $Revision$\r
28  */\r
29 public class SequenceFeature\r
30 {\r
31     public int begin;\r
32     public int end;\r
33     public float score;\r
34     public String type;\r
35     public String description;\r
36     public String status;\r
37     Hashtable otherDetails;\r
38     public java.util.Vector links;\r
39 \r
40     // Feature group can be set from a features file\r
41     // as a group of features between STARTGROUP and ENDGROUP markers\r
42     public String featureGroup;\r
43 \r
44     public SequenceFeature()\r
45     {}\r
46 \r
47     public SequenceFeature(String type,\r
48                            String desc,\r
49                            String status,\r
50                            int begin, int end,\r
51                            String featureGroup)\r
52     {\r
53       this.type = type;\r
54       this.description = desc;\r
55       this.status = status;\r
56       this.begin = begin;\r
57       this.end = end;\r
58       this.featureGroup = featureGroup;\r
59     }\r
60     public SequenceFeature(String type,\r
61                            String desc,\r
62                            int begin, int end,\r
63                            float score,\r
64                            String featureGroup)\r
65     {\r
66       this.type = type;\r
67       this.description = desc;\r
68       this.status = status;\r
69       this.begin = begin;\r
70       this.end = end;\r
71       this.score = score;\r
72       this.featureGroup = featureGroup;\r
73     }\r
74 \r
75     public boolean equals(SequenceFeature sf)\r
76     {\r
77       if(begin != sf.begin\r
78       || end != sf.end)\r
79      return false;\r
80 \r
81 \r
82       if(!(type+description+status).equals\r
83          (sf.type+sf.description+sf.status))\r
84         return false;\r
85 \r
86       return true;\r
87     }\r
88 \r
89 \r
90     /**\r
91      * DOCUMENT ME!\r
92      *\r
93      * @return DOCUMENT ME!\r
94      */\r
95     public int getBegin()\r
96     {\r
97         return begin;\r
98     }\r
99 \r
100     public void setBegin(int start)\r
101     {\r
102       this.begin = start;\r
103     }\r
104 \r
105     /**\r
106      * DOCUMENT ME!\r
107      *\r
108      * @return DOCUMENT ME!\r
109      */\r
110     public int getEnd()\r
111     {\r
112         return end;\r
113     }\r
114 \r
115     public void setEnd(int end)\r
116     {\r
117       this.end = end;\r
118     }\r
119 \r
120     /**\r
121      * DOCUMENT ME!\r
122      *\r
123      * @return DOCUMENT ME!\r
124      */\r
125     public String getType()\r
126     {\r
127         return type;\r
128     }\r
129 \r
130     public void setType(String type)\r
131     {\r
132       this.type = type;\r
133     }\r
134 \r
135     /**\r
136      * DOCUMENT ME!\r
137      *\r
138      * @return DOCUMENT ME!\r
139      */\r
140     public String getDescription()\r
141     {\r
142         return description;\r
143     }\r
144 \r
145     public void setDescription(String desc)\r
146     {\r
147       description = desc;\r
148     }\r
149 \r
150     /**\r
151      * DOCUMENT ME!\r
152      *\r
153      * @return DOCUMENT ME!\r
154      */\r
155     public String getStatus()\r
156     {\r
157         return status;\r
158     }\r
159 \r
160     public void setStatus(String status)\r
161     {\r
162       this.status = status;\r
163     }\r
164 \r
165     public String getFeatureGroup()\r
166     {\r
167       return featureGroup;\r
168     }\r
169 \r
170     public void setFeatureGroup(String featureGroup)\r
171     {\r
172       this.featureGroup = featureGroup;\r
173     }\r
174 \r
175     public void addLink(String labelLink)\r
176     {\r
177       if(links==null)\r
178         links = new java.util.Vector();\r
179 \r
180       links.insertElementAt(labelLink,0);\r
181     }\r
182 \r
183     public float getScore()\r
184     {\r
185       return score;\r
186     }\r
187 \r
188     public void setScore(float value)\r
189     {\r
190       score = value;\r
191     }\r
192 \r
193     /**\r
194      * Used for getting values which are not in the\r
195      * basic set. eg STRAND, FRAME for GFF file\r
196      * @param key String\r
197      */\r
198     public Object getValue(String key)\r
199     {\r
200       if(otherDetails==null)\r
201         return null;\r
202       else\r
203         return otherDetails.get(key);\r
204     }\r
205 \r
206     /**\r
207      * Used for setting values which are not in the\r
208      * basic set. eg STRAND, FRAME for GFF file\r
209      * @param key   eg STRAND\r
210      * @param value eg +\r
211      */\r
212     public void setValue(String key, Object value)\r
213     {\r
214       if(otherDetails == null)\r
215         otherDetails = new Hashtable();\r
216 \r
217       otherDetails.put(key, value);\r
218     }\r
219 \r
220 \r
221 }\r