JAL-674 JAL-961 properties to stash additional information for an alignment annotatio...
[jalview.git] / src / jalview / datamodel / AlignmentAnnotation.java
index 603efe0..78f64ac 100755 (executable)
@@ -26,7 +26,9 @@ import jalview.analysis.WUSSParseException;
 
 import java.util.ArrayList;
 import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.Hashtable;
+import java.util.Map;
 import java.util.Map.Entry;
 
 /**
@@ -1119,6 +1121,11 @@ public class AlignmentAnnotation
   protected String calcId = "";
 
   /**
+   * properties associated with the calcId
+   */
+  protected Map<String, String> properties = new HashMap<String, String>();
+
+  /**
    * base colour for line graphs. If null, will be set automatically by
    * searching the alignment annotation
    */
@@ -1202,6 +1209,8 @@ public class AlignmentAnnotation
    * @param idxoffset
    *          - offset added to index when referencing either coordinate system
    * @note no checks are made as to whether from and/or to are sensible
+   * @note caller should add the remapped annotation to newref if they have not
+   *       already
    */
   public void remap(SequenceI newref, int[][] mapping, int from, int to,
           int idxoffset)
@@ -1252,4 +1261,22 @@ public class AlignmentAnnotation
       adjustForAlignment();
     }
   }
+
+  public Object getProperty(String property)
+  {
+    if (properties == null)
+    {
+      return null;
+    }
+    return properties.get(property);
+  }
+
+  public void setProperty(String property, String value)
+  {
+    if (properties==null)
+    {
+      properties = new HashMap<String,String>();
+    }
+    properties.put(property, value);
+  }
 }