01: package test.pholser;
02:
03: import java.util.ArrayList;
04: import java.util.Collections;
05: import java.util.List;
06:
07: /**
08: * @author <a href="mailto:pholser@thoughtworks.com">Paul Holser</a>
09: * @version $Id: Captor.java,v 1.1 2004/10/26 23:29:47 the_mindstorm Exp $
10: */
11: public class Captor {
12: private static Captor instance = null;
13: private List captives;
14:
15: public static Captor instance() {
16: if (null == instance)
17: instance = new Captor();
18: return instance;
19: }
20:
21: public static void reset() {
22: // System.out.println("@@PHOLSER RESETTING CAPTOR");
23: instance().captives = new ArrayList();
24: }
25:
26: public void capture(String aString) {
27: // System.out.println("@@PHOLSER CAPTURING " + aString);
28: captives.add(aString);
29: }
30:
31: public List captives() {
32: return Collections.unmodifiableList(captives);
33: }
34: }
|