2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
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.
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.
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
19 package jalview.datamodel;
29 public class SequenceFeature
35 public String description;
36 public Hashtable otherDetails;
37 public java.util.Vector links;
39 // Feature group can be set from a features file
40 // as a group of features between STARTGROUP and ENDGROUP markers
41 public String featureGroup;
43 public SequenceFeature()
47 * Constructs a duplicate feature.
48 * Note: Uses clone on the otherDetails so only shallow copies are made
49 * of additional properties and method will silently fail if unclonable
50 * objects are found in the hash.
53 public SequenceFeature(SequenceFeature cpy)
62 type = new String(cpy.type);
64 if (cpy.description != null)
66 description = new String(cpy.description);
68 if (cpy.featureGroup != null)
70 featureGroup = new String(cpy.featureGroup);
72 if (cpy.otherDetails != null)
76 otherDetails = (Hashtable) cpy.otherDetails.clone();
80 // Uncloneable objects in the otherDetails - don't complain
83 if (cpy.links != null && cpy.links.size() > 0)
86 for (int i = 0, iSize = cpy.links.size(); i < iSize; i++)
88 links.addElement(cpy.links.elementAt(i));
94 public SequenceFeature(String type,
101 this.description = desc;
102 setValue("status", status);
105 this.featureGroup = featureGroup;
108 public SequenceFeature(String type,
115 this.description = desc;
119 this.featureGroup = featureGroup;
122 public boolean equals(SequenceFeature sf)
124 if (begin != sf.begin
126 || score != sf.score)
131 if (! (type + description + featureGroup).equals
132 (sf.type + sf.description + sf.featureGroup))
143 * @return DOCUMENT ME!
145 public int getBegin()
150 public void setBegin(int start)
158 * @return DOCUMENT ME!
165 public void setEnd(int end)
173 * @return DOCUMENT ME!
175 public String getType()
180 public void setType(String type)
188 * @return DOCUMENT ME!
190 public String getDescription()
195 public void setDescription(String desc)
200 public String getFeatureGroup()
205 public void setFeatureGroup(String featureGroup)
207 this.featureGroup = featureGroup;
210 public void addLink(String labelLink)
214 links = new java.util.Vector();
217 links.insertElementAt(labelLink, 0);
220 public float getScore()
225 public void setScore(float value)
231 * Used for getting values which are not in the
232 * basic set. eg STRAND, FRAME for GFF file
235 public Object getValue(String key)
237 if (otherDetails == null)
243 return otherDetails.get(key);
248 * Used for setting values which are not in the
249 * basic set. eg STRAND, FRAME for GFF file
250 * @param key eg STRAND
253 public void setValue(String key, Object value)
257 if (otherDetails == null)
259 otherDetails = new Hashtable();
262 otherDetails.put(key, value);
267 * The following methods are added to maintain
268 * the castor Uniprot mapping file for the moment.
270 public void setStatus(String status)
272 setValue("status", status);
275 public String getStatus()
277 if (otherDetails != null)
279 return otherDetails.get("status").toString();
287 public void setPosition(int pos)
293 public int getPosition()