1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/samples/growingparameters/src-api2.0/api/classes/Compute.java Sat Jun 14 09:53:37 2008 +0200
1.3 @@ -0,0 +1,27 @@
1.4 +package api.classes;
1.5 +
1.6 +import java.util.LinkedHashMap;
1.7 +import java.util.List;
1.8 +import java.util.Map;
1.9 +
1.10 +// BEGIN: grow.compute
1.11 +public abstract class Compute {
1.12 + /**
1.13 + * @return list of strings to work with
1.14 + * @since 1.0 */
1.15 + public abstract List<String> getData();
1.16 + /** Computes the strings to work with together with their associated descriptions.
1.17 + * Shall be overriden in subclasses. By default delegates to {@link #getData}
1.18 + * and uses the provided strings as both, the string and its description.
1.19 + *
1.20 + * @return name to description pairs to work with
1.21 + * @since 2.0 */
1.22 + public Map<String,String> getDataAndDescription() {
1.23 + LinkedHashMap<String,String> ret = new LinkedHashMap<String, String>();
1.24 + for (String s : getData()) {
1.25 + ret.put(s, s);
1.26 + }
1.27 + return ret;
1.28 + }
1.29 +}
1.30 +// END: grow.compute