From dbcfef03ad3d2853eda62c727978a160fc347f58 Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 23 Jan 2007 08:06:06 +0000 Subject: [PATCH] refactoring (added seqIndex/resIndex state for incremental search) --- src/jalview/analysis/Finder.java | 40 +++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/jalview/analysis/Finder.java b/src/jalview/analysis/Finder.java index f3ec514..e24a6c0 100644 --- a/src/jalview/analysis/Finder.java +++ b/src/jalview/analysis/Finder.java @@ -14,10 +14,21 @@ public class Finder { boolean caseSensitive=false; boolean findAll=false; com.stevesoft.pat.Regex regex=null; + /** + * hold's last-searched position between calles to find(false) + */ + int seqIndex=0,resIndex=0; public Finder(AlignmentI alignment, SequenceGroup selection) { this.alignment=alignment; this.selection = selection; } + + public Finder(AlignmentI alignment, SequenceGroup selectionGroup, int seqIndex, int resIndex) { + this(alignment, selectionGroup); + this.seqIndex=seqIndex; + this.resIndex=resIndex; + } + public boolean find(String searchString) { boolean hasResults=false; if(!caseSensitive) @@ -26,7 +37,6 @@ public class Finder { searchResults = new SearchResults(); idMatch = new Vector(); Sequence seq; - int seqIndex=0,resIndex=0; String item = null; boolean found = false; @@ -232,4 +242,32 @@ public class Finder { public SearchResults getSearchResults() { return searchResults; } + + /** + * @return the resIndex + */ + public int getResIndex() { + return resIndex; + } + + /** + * @param resIndex the resIndex to set + */ + public void setResIndex(int resIndex) { + this.resIndex = resIndex; + } + + /** + * @return the seqIndex + */ + public int getSeqIndex() { + return seqIndex; + } + + /** + * @param seqIndex the seqIndex to set + */ + public void setSeqIndex(int seqIndex) { + this.seqIndex = seqIndex; + } } -- 1.7.10.2