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