Merge commit 'alpha/update_2_12_for_2_11_2_series_merge^2' into HEAD
[jalview.git] / src / jalview / datamodel / Sequence.java
index 009a290..846b876 100755 (executable)
@@ -86,7 +86,6 @@ public class Sequence extends ASequence implements SequenceI
   HiddenMarkovModel hmm;
 
   boolean isHMMConsensusSequence = false;
-
   private DBModList<DBRefEntry> dbrefs; // controlled access
 
   /**
@@ -370,7 +369,6 @@ public class Sequence extends ASequence implements SequenceI
     {
       this.hmm = new HiddenMarkovModel(seq.getHMM(), this);
     }
-
   }
 
   @Override
@@ -1810,14 +1808,30 @@ public class Sequence extends ASequence implements SequenceI
   public List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
           String label)
   {
+    return getAlignmentAnnotations(calcId, label, null, true);
+  }
+
+  @Override
+  public List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
+          String label, String description)
+  {
+    return getAlignmentAnnotations(calcId, label, description, false);
+  }
+
+  private List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
+          String label, String description, boolean ignoreDescription)
+  {
     List<AlignmentAnnotation> result = new ArrayList<>();
     if (this.annotation != null)
     {
       for (AlignmentAnnotation ann : annotation)
       {
         String id = ann.getCalcId();
-        if (id != null && id.equals(calcId)
-                && ann.label != null && ann.label.equals(label))
+        if ((id != null && id.equals(calcId))
+                && (ann.label != null && ann.label.equals(label))
+                && ((ignoreDescription && description == null)
+                        || (ann.description != null
+                                && ann.description.equals(description))))
         {
           result.add(ann);
         }
@@ -1963,7 +1977,6 @@ public class Sequence extends ASequence implements SequenceI
     }
     return false;
   }
-
   /**
    * {@inheritDoc}
    */