diff --git a/src/eva2/tools/StringSelection.java b/src/eva2/tools/StringSelection.java index ecb6cbed..2bcbc927 100644 --- a/src/eva2/tools/StringSelection.java +++ b/src/eva2/tools/StringSelection.java @@ -145,10 +145,57 @@ public class StringSelection implements Serializable { // return false; } + /** + * Return the ordinal of the given String within the StringSelection. If + * the string could not be found, -1 is returned. + * + * @param str + * @return + */ + public int stringToIndex(String str) { + if (stringToIndexHash == null) { // for some time efficiency... + stringToIndexHash = new HashMap(2*strObjects.length); + for (int i=0; i=0) { + setSelected(index,v); + } else { + System.err.println("Error, unknown string " + str + " cant be selected in " + this.getClass()); + } + } + + /** + * Set the selection state of a field. The index must be valid. + * + * @param i + * @param v + */ public void setSelected(int i, boolean v) { selStates[i]=v; } + /** + * Toggle the selection state of a field. The index must be valid. + * + * @param i + */ public void toggleSelected(int i) { selStates[i]=!selStates[i]; }