JAL-2828 allow CalcId to match on String equivalence (migrated from Alignment’s imple... doc/JAL-2494_JAL-2828_mergefindAnnotation
authorJim Procter <jprocter@issues.jalview.org>
Fri, 10 Nov 2017 16:46:15 +0000 (16:46 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Fri, 10 Nov 2017 16:48:37 +0000 (16:48 +0000)
src/jalview/datamodel/Alignment.java
src/jalview/datamodel/AlignmentAnnotation.java

index 77667b9..f268d37 100755 (executable)
@@ -1618,20 +1618,13 @@ public class Alignment implements AlignmentI
   @Override
   public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
   {
-    List<AlignmentAnnotation> aa = new ArrayList<>();
     AlignmentAnnotation[] alignmentAnnotation = getAlignmentAnnotation();
     if (alignmentAnnotation != null)
     {
-      for (AlignmentAnnotation a : alignmentAnnotation)
-      {
-        if (a.getCalcId() == calcId || (a.getCalcId() != null
-                && calcId != null && a.getCalcId().equals(calcId)))
-        {
-          aa.add(a);
-        }
-      }
+      return AlignmentAnnotation.findAnnotation(
+              Arrays.asList(getAlignmentAnnotation()), calcId);
     }
-    return aa;
+    return Arrays.asList(new AlignmentAnnotation[] {});
   }
 
   @Override
index ffc3105..f7bf4d8 100755 (executable)
@@ -1530,7 +1530,9 @@ public class AlignmentAnnotation
     }
     for (AlignmentAnnotation a : list)
     {
-      if (calcId.equals(a.getCalcId()))
+
+      if (a.getCalcId() == calcId || (a.getCalcId() != null
+              && calcId != null && a.getCalcId().equals(calcId)))
       {
         aa.add(a);
       }