samples/growingparameters/src-api2.0/api/classes/Compute.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:56:12 +0200
changeset 132 3bc4c54f4bcc
parent 77 22c1953e372c
child 153 b5cbb797ec0a
permissions -rw-r--r--
Truncating all examples to 80 characters per line
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@132
    13
    /** Computes the strings to work with together with their 
jtulach@132
    14
     * associated descriptions. Shall be overriden in subclasses. 
jtulach@132
    15
     * By default delegates to {@link #getData}
jtulach@132
    16
     * and uses the provided strings as both, the string 
jtulach@132
    17
     * and its description.
jtulach@77
    18
     * 
jtulach@77
    19
     * @return name to description pairs to work with 
jtulach@77
    20
     * @since 2.0 */
jtulach@77
    21
    public Map<String,String> getDataAndDescription() {
jtulach@132
    22
        LinkedHashMap<String,String> ret = 
jtulach@132
    23
            new LinkedHashMap<String, String>();
jtulach@77
    24
        for (String s : getData()) {
jtulach@77
    25
            ret.put(s, s);
jtulach@77
    26
        }
jtulach@77
    27
        return ret;
jtulach@77
    28
    }
jtulach@77
    29
}
jtulach@77
    30
// END: grow.compute