From b16a3f9999681fee83f87ba0ecd309d32383f28f Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 10 Nov 2017 16:46:15 +0000 Subject: [PATCH] =?utf8?q?JAL-2828=20allow=20CalcId=20to=20match=20on=20Stri?= =?utf8?q?ng=20equivalence=20(migrated=20from=20Alignment=E2=80=99s=20implem?= =?utf8?q?entation=20of=20findAnnotation)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/datamodel/Alignment.java | 13 +++---------- src/jalview/datamodel/AlignmentAnnotation.java | 4 +++- 2 files changed, 6 insertions(+), 11 deletions(-) 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); } -- 1.7.10.2