X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fdatamodel%2FSequenceFeature.java;h=094e060662c3f88331227235eab017b45c58c23b;hb=68a0d4900885cec55096d1f266ee15ef6217f754;hp=e94244db74f0da57881fe5e0259db85649199d44;hpb=f3f53bcb688bcbf756ebd667a4c599e1354663ac;p=jalview.git diff --git a/src/jalview/datamodel/SequenceFeature.java b/src/jalview/datamodel/SequenceFeature.java index e94244d..094e060 100755 --- a/src/jalview/datamodel/SequenceFeature.java +++ b/src/jalview/datamodel/SequenceFeature.java @@ -1,152 +1,267 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.datamodel; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class SequenceFeature -{ - int position; - int begin; - int end; - String type; - String description; - String status; - - // Feature group can be set from a features file - // as a group of features between STARTGROUP and ENDGROUP markers - String featureGroup; - - public SequenceFeature() - {} - - public SequenceFeature(String type, String desc, String status, int begin, int end) - { - this.type = type; - this.description = desc; - this.status = status; - this.position = begin; - this.begin = begin; - this.end = end; - } - - public int getPosition() - { - return position; - } - - public void setPosition(int pos) - { - position = pos; - begin = pos; - end = pos; - } - - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public int getBegin() - { - return begin; - } - - public void setBegin(int start) - { - this.begin = start; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public int getEnd() - { - return end; - } - - public void setEnd(int end) - { - this.end = end; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public String getType() - { - return type; - } - - public void setType(String type) - { - this.type = type; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public String getDescription() - { - return description; - } - - public void setDescription(String desc) - { - description = desc; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public String getStatus() - { - return status; - } - - public void setStatus(String status) - { - this.status = status; - } - - public String getFeatureGroup() - { - return featureGroup; - } - - public void setFeatureGroup(String featureGroup) - { - this.featureGroup = featureGroup; - } - - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer + * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.datamodel; + +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class SequenceFeature +{ + public int begin; + public int end; + public float score; + public String type; + public String description; + public Hashtable otherDetails; + public java.util.Vector links; + + // Feature group can be set from a features file + // as a group of features between STARTGROUP and ENDGROUP markers + public String featureGroup; + + public SequenceFeature() + {} + /** + * Constructs a duplicate feature. + * Note: Uses clone on the otherDetails so only shallow copies are made + * of additional properties and method will silently fail if unclonable + * objects are found in the hash. + * @param cpy + */ + public SequenceFeature(SequenceFeature cpy) { + if (cpy!=null) { + begin = cpy.begin; + end = cpy.end; + score = cpy.score; + type = new String(cpy.type); + description = new String(cpy.description); + featureGroup = new String(cpy.featureGroup); + if (cpy.otherDetails!=null) { + try { + otherDetails = (Hashtable) cpy.otherDetails.clone(); + } catch (Exception e) { + // Uncloneable objects in the otherDetails - don't complain + } + } + if (cpy.links!=null && cpy.links.size()>0) { + links=new Vector(); + for (int i=0,iSize=cpy.links.size(); i