From: Jim Procter Date: Mon, 3 Nov 2014 10:01:43 +0000 (+0000) Subject: JAL-674 JAL-961 JAL-1578 accessors and copy constructor for annotation row properties X-Git-Tag: Jalview_2_9~155^2~15^2~7 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f4c507635c079ec4cb16273b4911bc33b29afb31;p=jalview.git JAL-674 JAL-961 JAL-1578 accessors and copy constructor for annotation row properties --- diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 936ba42..e0a8e6e 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -634,6 +634,14 @@ public class AlignmentAnnotation this.scaleColLabel = annotation.scaleColLabel; this.showAllColLabels = annotation.showAllColLabels; this.calcId = annotation.calcId; + if (annotation.properties!=null) + { + properties = new HashMap(); + for (Map.Entry val:annotation.properties.entrySet()) + { + properties.put(val.getKey(), val.getValue()); + } + } if (this.hasScore = annotation.hasScore) { this.score = annotation.score; @@ -1272,7 +1280,7 @@ public class AlignmentAnnotation } } - public Object getProperty(String property) + public String getProperty(String property) { if (properties == null) { @@ -1289,4 +1297,18 @@ public class AlignmentAnnotation } properties.put(property, value); } + + public boolean hasProperties() + { + return properties != null && properties.size() > 0; + } + + public Collection getProperties() + { + if (properties == null) + { + return Collections.EMPTY_LIST; + } + return properties.keySet(); + } }