From: Jim Procter Date: Fri, 10 Nov 2017 16:46:15 +0000 (+0000) Subject: JAL-2828 allow CalcId to match on String equivalence (migrated from Alignment’s imple... X-Git-Tag: Release_2_10_3b1~24^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b16a3f9999681fee83f87ba0ecd309d32383f28f;p=jalview.git JAL-2828 allow CalcId to match on String equivalence (migrated from Alignment’s implementation of findAnnotation) --- diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 77667b9..f268d37 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -1618,20 +1618,13 @@ public class Alignment implements AlignmentI @Override public Iterable findAnnotation(String calcId) { - List 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 diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index ffc3105..f7bf4d8 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -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); }