samples/growingparameters/src-api2.0/api/classes/Support.java
changeset 77 22c1953e372c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/samples/growingparameters/src-api2.0/api/classes/Support.java	Sat Jun 14 09:53:37 2008 +0200
     1.3 @@ -0,0 +1,31 @@
     1.4 +package api.classes;
     1.5 +
     1.6 +import java.util.Iterator;
     1.7 +import java.util.Map.Entry;
     1.8 +
     1.9 +public class Support {
    1.10 +    private Support() {
    1.11 +    }
    1.12 +    
    1.13 +    public static int searchByName(String name, Compute provider) {
    1.14 +        Iterator<String> it = provider.getData().iterator();
    1.15 +        for (int i = 0; it.hasNext(); i++) {
    1.16 +            if (name.equals(it.next())) {
    1.17 +                return i;
    1.18 +            }
    1.19 +        }
    1.20 +        return -1;
    1.21 +    }
    1.22 +
    1.23 +    /** @since 2.0 */
    1.24 +    public static int searchByDescription(String name, Compute provider) {
    1.25 +        Iterator<Entry<String, String>> it = provider.getDataAndDescription().entrySet().iterator();
    1.26 +        for (int i = 0; it.hasNext(); i++) {
    1.27 +            if (name.equals(it.next().getValue())) {
    1.28 +                return i;
    1.29 +            }
    1.30 +        }
    1.31 +        return -1;
    1.32 +    }
    1.33 +    
    1.34 +}