samples/growingparameters/src-api1.0/api/request/response/Compute.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 10:04:53 +0200
changeset 210 acf2c31e22d4
parent 209 1c999569643b
permissions -rw-r--r--
Merge: Geertjan's changes to the end of the chapter
jtulach@78
     1
package api.request.response;
jtulach@78
     2
jtulach@78
     3
import java.util.List;
jtulach@78
     4
jtulach@78
     5
public interface Compute {
jtulach@78
     6
    public void computeData(Request request, Response response);
jtulach@78
     7
    
jtulach@78
     8
    /** Right now useless, but may be handy in future */
jtulach@78
     9
    public final class Request {
jtulach@78
    10
        /** allow access just from friend code */
jtulach@78
    11
        Request() {
jtulach@78
    12
        }
jtulach@78
    13
    }
jtulach@78
    14
    
jtulach@78
    15
    /** Allows clients to provide the computed strings */
jtulach@78
    16
    public final class Response {
jtulach@78
    17
        private final List<String> result;
jtulach@78
    18
        /** Allow access only to friend code */
jtulach@78
    19
        Response(List<String> result) {
jtulach@78
    20
            this.result = result;
jtulach@78
    21
        }
jtulach@78
    22
        
jtulach@78
    23
        public void add(String s) {
jtulach@210
    24
            result.add(s);
jtulach@78
    25
        }
jtulach@78
    26
        
jtulach@78
    27
        public void addAll(List<String> all) {
jtulach@210
    28
            result.addAll(all);
jtulach@78
    29
        }
jtulach@78
    30
    }
jtulach@78
    31
}