X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSequenceFeature.java;h=14ce0ff52437a984de51aefedcba554af7c460ce;hb=dd74fc4938723fe5ec48d4e5fdcfbe58ac42a48d;hp=1adff257d1318a19459b6cb4d9a2fbc33feef438;hpb=55e2e9b22b133db8b9ff0979b0338a33081fc8fd;p=jalview.git diff --git a/src/jalview/datamodel/SequenceFeature.java b/src/jalview/datamodel/SequenceFeature.java index 1adff25..14ce0ff 100755 --- a/src/jalview/datamodel/SequenceFeature.java +++ b/src/jalview/datamodel/SequenceFeature.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * 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 @@ -18,6 +18,10 @@ */ package jalview.datamodel; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; + /** * DOCUMENT ME! * @@ -26,36 +30,93 @@ package jalview.datamodel; */ public class SequenceFeature { - int position; - int begin; - int end; - String type; - String description; - String status; + 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() {} - - public SequenceFeature(String type, String desc, String status, int begin, int end) + /** + * 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; + if (cpy.type != null) + type = new String(cpy.type); + if (cpy.description != null) + description = new String(cpy.description); + if (cpy.featureGroup != null) + 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