01 /*
02 * DefaultActionContext.java
03 *
04 * Copyright (c) 1995-2010, The University of Sheffield. See the file
05 * COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
06 *
07 * This file is part of GATE (see http://gate.ac.uk/), and is free
08 * software, licenced under the GNU Library General Public License,
09 * Version 2, June 1991 (in the distribution as file licence.html,
10 * and also available at http://gate.ac.uk/gate/licence.html).
11 *
12 * $Id: $
13 *
14 */
15
16 package gate.jape;
17
18 import gate.Controller;
19 import gate.Corpus;
20 import gate.FeatureMap;
21
22 /**
23 * Default implementation for an action context.<br>
24 * Note: A JAPE RHS should only ever use the methods defined in
25 * the ActionContext interface, the additional methods implemented here
26 * are for use by the Transducer only.
27 *
28 * @author Johann Petrak
29 */
30 public class DefaultActionContext implements ActionContext {
31 protected Corpus corpus;
32 protected FeatureMap prfeatures;
33 protected Controller controller;
34 protected boolean endPhaseSupported;
35 protected boolean phaseEnded = false;
36
37 public DefaultActionContext() {}
38
39 public void setCorpus(Corpus corpus) {
40 this.corpus = corpus;
41 }
42 public void setPRFeatures(FeatureMap features) {
43 this.prfeatures = features;
44 }
45
46 public Corpus getCorpus() {
47 return corpus;
48 }
49
50 public FeatureMap getPRFeatures() {
51 return prfeatures;
52 }
53
54 public void setController(Controller c) {
55 controller = c;
56 }
57
58 public Controller getController() {
59 return controller;
60 }
61
62 public boolean endPhase() {
63 phaseEnded = true;
64 // all transducers using this ActionContext implementation support
65 // ending a phase. If another implementation does not support it,
66 // use a different ActionContext implementation (e.g. a subclass of this)
67 // or change the way singalling this is implemented.
68 return true;
69 }
70
71
72 public boolean isPhaseEnded() {
73 return phaseEnded;
74 }
75
76 public void setPhaseEnded(boolean isended) {
77 phaseEnded = isended;
78 }
79
80 }
|