JAL-1481 wrap tooltip in html
[jalview.git] / src / jalview / datamodel / Sequence.java
index 945a9d4..f628699 100755 (executable)
@@ -22,7 +22,9 @@ package jalview.datamodel;
 
 import jalview.analysis.AlignSeq;
 
+import java.util.ArrayList;
 import java.util.Enumeration;
+import java.util.List;
 import java.util.Vector;
 
 import fr.orsay.lri.varna.models.rna.RNA;
@@ -901,7 +903,7 @@ public class Sequence implements SequenceI
     AlignmentAnnotation[] ret = new AlignmentAnnotation[annotation.size()];
     for (int r = 0; r < ret.length; r++)
     {
-      ret[r] = (AlignmentAnnotation) annotation.elementAt(r);
+      ret[r] = annotation.elementAt(r);
     }
 
     return ret;
@@ -1080,6 +1082,33 @@ public class Sequence implements SequenceI
     return anns;
   }
 
+  /**
+   * Returns a list of any annotations on the sequence that match the given
+   * calcId (source) and label (type). Null values do not match.
+   * 
+   * @param calcId
+   * @param label
+   * @return
+   */
+  @Override
+  public List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
+          String label)
+  {
+    List<AlignmentAnnotation> result = new ArrayList<AlignmentAnnotation>();
+    if (annotation != null)
+    {
+      for (AlignmentAnnotation ann : annotation)
+      {
+        if (ann.calcId != null && ann.calcId.equals(calcId)
+                && ann.label != null && ann.label.equals(label))
+        {
+          result.add(ann);
+        }
+      }
+    }
+    return result;
+  }
+
   public boolean updatePDBIds()
   {
     if (datasetSequence != null)