From: jprocter Date: Fri, 21 Dec 2007 15:05:33 +0000 (+0000) Subject: javadoc and bugfix X-Git-Tag: Release_2_4~164 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a3f3ef6087f2be16d21bf2db97bd8e22e0c3f2b3;p=jalview.git javadoc and bugfix --- diff --git a/src/jalview/analysis/ParseProperties.java b/src/jalview/analysis/ParseProperties.java index 43460d6..587e501 100644 --- a/src/jalview/analysis/ParseProperties.java +++ b/src/jalview/analysis/ParseProperties.java @@ -30,14 +30,14 @@ public class ParseProperties this.al = al; } - public int getScoresFromDescription(String ScoreName, String ScoreDescriptions, String regex) + public int getScoresFromDescription(String ScoreName, String ScoreDescriptions, String regex, boolean repeat) { - return getScoresFromDescription(new String[] { ScoreName }, new String[] { ScoreDescriptions}, regex); + return getScoresFromDescription(new String[] { ScoreName }, new String[] { ScoreDescriptions}, regex, repeat); } - public int getScoresFromDescription(String[] ScoreNames, String[] ScoreDescriptions, String regex) + public int getScoresFromDescription(String[] ScoreNames, String[] ScoreDescriptions, String regex, boolean repeat) { - return getScoresFromDescription(al.getSequencesArray(), ScoreNames, ScoreDescriptions, regex); + return getScoresFromDescription(al.getSequencesArray(), ScoreNames, ScoreDescriptions, regex, repeat); } /** * Extract scores for sequences by applying regex to description string. @@ -45,9 +45,10 @@ public class ParseProperties * @param ScoreNames labels for each numeric field in regex match * @param ScoreDescriptions description for each numeric field in regex match * @param regex Regular Expression string for passing to new com.stevesoft.patt.Regex(regex) + * @param repeat true means the regex will be applied multiple times along the description string of each sequence * @return total number of sequences that matched the regex */ - public int getScoresFromDescription(SequenceI[] seqs, String[] ScoreNames, String[] ScoreDescriptions, String regex) + public int getScoresFromDescription(SequenceI[] seqs, String[] ScoreNames, String[] ScoreDescriptions, String regex, boolean repeat) { int count=0; Regex pattern = new Regex(regex); @@ -76,9 +77,11 @@ public class ParseProperties String descr = seqs[i].getDescription(); if (descr==null) continue; - if (pattern.search(descr)) + int pos=0; + boolean added=false; + while ((repeat || pos==0) && pattern.searchFrom(descr, pos)) { - boolean added=false; + pos = pattern.matchedTo(); for (int cols=0; cols