ActionContext.java
01 /*
02  *  ActionContext.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 import java.io.Serializable;
22 
23 /**
24  * Interface describing an "action context" for a JAPE Java RHS. An action
25  * context provides access to the JAPE processing resource's feature map and
26  * the corpus the JAPE PR is running on.
27  *
28  @author Johann Petrak
29  */
30 public interface ActionContext  extends Serializable {
31   /**
32    * Provide access to the corpus a JAPE processing resource is running on.
33    @return the corpus LR the JAPE transducer is processing, null if no
34    * such corpus exists.
35    */
36   public Corpus getCorpus();
37   /**
38    * Provide access to the feature map associated with the JAPE processing
39    * resource.
40    @return the FeatureMap of the processing resource
41    */
42   public FeatureMap getPRFeatures();
43   /**
44    * Provide access to the controller running the PR this action context
45    * lives in.
46    @return the Controller resource
47    */
48   public Controller getController();
49   /**
50    * Request the current JAPE phase to be ended as soon as possible.
51    * After the current RHS code has returned, the phase will be ended as soon
52    * as possible if the JAPE implementation supports this feature.
53    * The method returns false if this feature is not supported or if it is
54    * known that ending the phase prematurely is not possible, true otherwise.
55    @return true if ending the phase prematurely is supported, false otherwise
56    */
57   public boolean endPhase();
58 }