01: package U2.T2;
02:
03: import java.io.*;
04: import java.util.*;
05:
06: /**
07: * A base domain provides a supply of objects. When T2's {@link
08: * U2.T2.RndEngine test engine} needs to generate an object of a
09: * class C, it first checks if it can get it from the base domain. If
10: * it can get one, say x, then the engine will create a <i>clone</i>
11: * of x and use the clone. If the base domain cannot supply an
12: * instance of C, then the engine continues with either looking an
13: * instance in its own {@link U2.T2.Pool object pool}, or creates a
14: * fresh instance. See also the global explanation in {@link U2.T2
15: * U2.T2 package overview}.
16: *
17: * <p>For cloning the engine relias on serialization, so it is
18: * essential that objects supplied by a base domain are
19: * serializable. Cloning is done to make sure that the objects in the
20: * base domain are shielded from the engine's side effect. The cloning
21: * is btw not done by the base domain itself; it is the responsibility
22: * of the test engine. So if you implement your own test engine, do
23: * keep this in mind.
24: *
25: * <p>Base domain essentially defines the value space over which the
26: * test engine will range. E.g. we can make it very small, large but
27: * still finite, or unbounded.
28: *
29: * <p>To define his own base domain, the test engineer should provide
30: * an implementation of this abstract class, and pass it to the test
31: * engine, e.g. via the {@link U2.T2.RndEngine#RndTest RndTest API}. A
32: * {@link U2.T2.BaseDomain0 default implementation} is provided.
33: *
34: */
35: public abstract class BaseDomain {
36:
37: /**
38: * Draw a random object of class C from this base domain. If none
39: * can be found, it returns null. If an object can be found, it
40: * will be returned in return[0]. It is essential that the method
41: * only draws an object of exactly the class C. So it won't search
42: * in the subclasses.
43: */
44: abstract public Object[] rndGET(Class C);
45:
46: }
|