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
     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 
    14      * associated descriptions. Shall be overriden in subclasses. 
    15      * By default delegates to {@link #getData}
    16      * and uses the provided strings as both, the string 
    17      * and its description.
    18      * 
    19      * @return name to description pairs to work with 
    20      * @since 2.0 */
    21     public Map<String,String> getDataAndDescription() {
    22         LinkedHashMap<String,String> ret = 
    23             new LinkedHashMap<String, String>();
    24         for (String s : getData()) {
    25             ret.put(s, s);
    26         }
    27         return ret;
    28     }
    29 }
    30 // END: grow.compute