JAL-1620 version bump and release notes
[jalview.git] / src / jalview / datamodel / SequenceGroup.java
index f8fd3ee..0944c34 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1)
  * Copyright (C) 2014 The Jalview Authors
  * 
  * This file is part of Jalview.
@@ -178,7 +178,9 @@ public class SequenceGroup implements AnnotatedCollectionI
       endRes = seqsel.endRes;
       cs = seqsel.cs;
       if (seqsel.description != null)
+      {
         description = new String(seqsel.description);
+      }
       hidecols = seqsel.hidecols;
       hidereps = seqsel.hidereps;
       idColour = seqsel.idColour;
@@ -238,7 +240,9 @@ public class SequenceGroup implements AnnotatedCollectionI
                 }
               }
               if (!found)
+              {
                 continue;
+              }
             }
             AlignmentAnnotation newannot = new AlignmentAnnotation(
                     seq.getAnnotation()[a]);
@@ -1261,6 +1265,29 @@ public class SequenceGroup implements AnnotatedCollectionI
   }
 
   /**
+   * Returns a list of annotations that match the specified sequenceRef, calcId
+   * and label, ignoring null values.
+   * 
+   * @return list of AlignmentAnnotation objects
+   */
+  @Override
+  public Iterable<AlignmentAnnotation> findAnnotations(SequenceI seq,
+          String calcId, String label)
+  {
+    ArrayList<AlignmentAnnotation> aa = new ArrayList<AlignmentAnnotation>();
+    for (AlignmentAnnotation ann : getAlignmentAnnotation())
+    {
+      if (ann.getCalcId() != null && ann.getCalcId().equals(calcId)
+              && ann.sequenceRef != null && ann.sequenceRef == seq
+              && ann.label != null && ann.label.equals(label))
+      {
+        aa.add(ann);
+      }
+    }
+    return aa;
+  }
+
+  /**
    * Answer true if any annotation matches the calcId passed in (if not null).
    * 
    * @param calcId
@@ -1308,28 +1335,4 @@ public class SequenceGroup implements AnnotatedCollectionI
   {
     return context;
   }
-
-  @Override
-  public Iterable<AlignmentAnnotation> findAnnotation(
-          SequenceI datasequence, String calcId, String label)
-  {
-    List<AlignmentAnnotation> result = new ArrayList<AlignmentAnnotation>();
-    for (AlignmentAnnotation ann : getAlignmentAnnotation())
-    {
-      // only sequence-linked annotations can qualify (have a datasequence)
-      if (ann.sequenceRef == null)
-      {
-        continue;
-      }
-      boolean matchDatasequence = (ann.sequenceRef.getDatasetSequence() == datasequence);
-      final String annCalcId = ann.getCalcId();
-      boolean matchCalcId = (annCalcId != null && annCalcId.equals(calcId));
-      boolean matchLabel = (ann.label != null && ann.label.equals(label));
-      if (matchDatasequence && matchCalcId && matchLabel)
-      {
-        result.add(ann);
-      }
-    }
-    return result;
-  }
 }