2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2006 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;
21 import java.util.Enumeration;
22 import java.util.Hashtable;
23 import java.util.Vector;
31 public class SequenceFeature
37 public String description;
38 public Hashtable otherDetails;
39 public java.util.Vector links;
41 // Feature group can be set from a features file
42 // as a group of features between STARTGROUP and ENDGROUP markers
43 public String featureGroup;
45 public SequenceFeature()
47 public SequenceFeature(SequenceFeature cpy) {
52 type = new String(cpy.type);
53 description = new String(cpy.description);
54 featureGroup = new String(cpy.featureGroup);
55 if (cpy.otherDetails!=null) {
57 otherDetails = (Hashtable) cpy.otherDetails.clone();
58 } catch (Exception e) {
59 // Uncloneable objects in the otherDetails - don't complain
62 if (cpy.links!=null && cpy.links.size()>0) {
64 for (int i=0,iSize=cpy.links.size(); i<iSize; i++) {
65 links.setElementAt(cpy.links.elementAt(i), i);
70 public SequenceFeature(String type,
77 this.description = desc;
78 setValue("status", status);
81 this.featureGroup = featureGroup;
84 public SequenceFeature(String type,
91 this.description = desc;
95 this.featureGroup = featureGroup;
98 public boolean equals(SequenceFeature sf)
100 if (begin != sf.begin
102 || score != sf.score)
105 if(!(type+description+featureGroup).equals
106 (sf.type+sf.description+sf.featureGroup))
116 * @return DOCUMENT ME!
118 public int getBegin()
123 public void setBegin(int start)
131 * @return DOCUMENT ME!
138 public void setEnd(int end)
146 * @return DOCUMENT ME!
148 public String getType()
153 public void setType(String type)
161 * @return DOCUMENT ME!
163 public String getDescription()
168 public void setDescription(String desc)
173 public String getFeatureGroup()
178 public void setFeatureGroup(String featureGroup)
180 this.featureGroup = featureGroup;
183 public void addLink(String labelLink)
186 links = new java.util.Vector();
188 links.insertElementAt(labelLink,0);
191 public float getScore()
196 public void setScore(float value)
202 * Used for getting values which are not in the
203 * basic set. eg STRAND, FRAME for GFF file
206 public Object getValue(String key)
208 if(otherDetails==null)
211 return otherDetails.get(key);
215 * Used for setting values which are not in the
216 * basic set. eg STRAND, FRAME for GFF file
217 * @param key eg STRAND
220 public void setValue(String key, Object value)
224 if (otherDetails == null)
225 otherDetails = new Hashtable();
227 otherDetails.put(key, value);
233 * The following methods are added to maintain
234 * the castor Uniprot mapping file for the moment.
236 public void setStatus(String status)
238 setValue("status", status);
241 public String getStatus()
243 if (otherDetails != null)
244 return otherDetails.get("status").toString();
249 public void setPosition(int pos)
255 public int getPosition()