JAL-674 JAL-961 JAL-1578 accessors and copy constructor for annotation row properties
authorJim Procter <jprocter@dundee.ac.uk>
Mon, 3 Nov 2014 10:01:43 +0000 (10:01 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Mon, 3 Nov 2014 10:01:43 +0000 (10:01 +0000)
src/jalview/datamodel/AlignmentAnnotation.java

index 936ba42..e0a8e6e 100755 (executable)
@@ -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<String,String>();
+      for (Map.Entry<String, String> 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<String> getProperties()
+  {
+    if (properties == null)
+    {
+      return Collections.EMPTY_LIST;
+    }
+    return properties.keySet();
+  }
 }