samples/growingparameters/src-api2.0/api/classes/Compute.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:58:08 +0200
changeset 153 b5cbb797ec0a
parent 132 3bc4c54f4bcc
child 154 0fd5e9c500b9
permissions -rw-r--r--
up to line 2000
jtulach@77
     1
package api.classes;
jtulach@77
     2
jtulach@77
     3
import java.util.LinkedHashMap;
jtulach@77
     4
import java.util.List;
jtulach@77
     5
import java.util.Map;
jtulach@77
     6
jtulach@77
     7
// BEGIN: grow.compute
jtulach@77
     8
public abstract class Compute {
jtulach@77
     9
    /**
jtulach@77
    10
     * @return list of strings to work with 
jtulach@77
    11
     * @since 1.0 */
jtulach@77
    12
    public abstract List<String> getData();
jtulach@153
    13
    /** Computes the strings to work with together with their associated descriptions.
jtulach@153
    14
     * Shall be overriden in subclasses. By default delegates to {@link #getData}
jtulach@153
    15
     * and uses the provided strings as both, the string and its description.
jtulach@77
    16
     * 
jtulach@77
    17
     * @return name to description pairs to work with 
jtulach@77
    18
     * @since 2.0 */
jtulach@77
    19
    public Map<String,String> getDataAndDescription() {
jtulach@153
    20
        LinkedHashMap<String,String> ret = new LinkedHashMap<String, String>();
jtulach@77
    21
        for (String s : getData()) {
jtulach@77
    22
            ret.put(s, s);
jtulach@77
    23
        }
jtulach@77
    24
        return ret;
jtulach@77
    25
    }
jtulach@77
    26
}
jtulach@77
    27
// END: grow.compute