From: amwaterhouse Date: Mon, 14 Nov 2005 11:59:13 +0000 (+0000) Subject: findByShortName X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=748cffd412de4d6951d8f746428ff601861fe144;p=jalview.git findByShortName --- diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index d945ec6..0b3adff 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -451,6 +451,23 @@ public class Alignment implements AlignmentI } } + public SequenceI findShortName(String name) + { + int i = 0; + + while (i < sequences.size()) + { + if (getSequenceAt(i).getShortName().equals(name)) + { + return getSequenceAt(i); + } + + i++; + } + + return null; + } + /** */ public SequenceI findName(String name) { @@ -458,11 +475,9 @@ public class Alignment implements AlignmentI while (i < sequences.size()) { - SequenceI s = getSequenceAt(i); - - if (s.getName().equals(name)) + if (getSequenceAt(i).getName().equals(name)) { - return s; + return getSequenceAt(i); } i++; diff --git a/src/jalview/datamodel/AlignmentI.java b/src/jalview/datamodel/AlignmentI.java index be3093c..ed1ec4e 100755 --- a/src/jalview/datamodel/AlignmentI.java +++ b/src/jalview/datamodel/AlignmentI.java @@ -125,6 +125,8 @@ public interface AlignmentI */ public SequenceI findName(String name); + public SequenceI findShortName(String name); + /** * Finds index of a given sequence in the alignment. @@ -305,4 +307,6 @@ public interface AlignmentI public void setProvenance(Provenance prov); + + }