gate.jape
Class DefaultActionContext

java.lang.Object
  extended by gate.jape.DefaultActionContext
All Implemented Interfaces:
ActionContext, Serializable

public class DefaultActionContext
extends Object
implements ActionContext

Default implementation for an action context.
Note: A JAPE RHS should only ever use the methods defined in the ActionContext interface, the additional methods implemented here are for use by the Transducer only.

Author:
Johann Petrak
See Also:
Serialized Form

Field Summary
protected  Controller controller
           
protected  Corpus corpus
           
protected  boolean endPhaseSupported
           
protected  boolean phaseEnded
           
protected  FeatureMap prfeatures
           
 
Constructor Summary
DefaultActionContext()
           
 
Method Summary
 boolean endPhase()
          Request the current JAPE phase to be ended as soon as possible.
 Controller getController()
          Provide access to the controller running the PR this action context lives in.
 Corpus getCorpus()
          Provide access to the corpus a JAPE processing resource is running on.
 FeatureMap getPRFeatures()
          Provide access to the feature map associated with the JAPE processing resource.
 boolean isPhaseEnded()
           
 void setController(Controller c)
           
 void setCorpus(Corpus corpus)
           
 void setPhaseEnded(boolean isended)
           
 void setPRFeatures(FeatureMap features)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

corpus

protected Corpus corpus

prfeatures

protected FeatureMap prfeatures

controller

protected Controller controller

endPhaseSupported

protected boolean endPhaseSupported

phaseEnded

protected boolean phaseEnded
Constructor Detail

DefaultActionContext

public DefaultActionContext()
Method Detail

setCorpus

public void setCorpus(Corpus corpus)

setPRFeatures

public void setPRFeatures(FeatureMap features)

getCorpus

public Corpus getCorpus()
Description copied from interface: ActionContext
Provide access to the corpus a JAPE processing resource is running on.

Specified by:
getCorpus in interface ActionContext
Returns:
the corpus LR the JAPE transducer is processing, null if no such corpus exists.

getPRFeatures

public FeatureMap getPRFeatures()
Description copied from interface: ActionContext
Provide access to the feature map associated with the JAPE processing resource.

Specified by:
getPRFeatures in interface ActionContext
Returns:
the FeatureMap of the processing resource

setController

public void setController(Controller c)

getController

public Controller getController()
Description copied from interface: ActionContext
Provide access to the controller running the PR this action context lives in.

Specified by:
getController in interface ActionContext
Returns:
the Controller resource

endPhase

public boolean endPhase()
Description copied from interface: ActionContext
Request the current JAPE phase to be ended as soon as possible. After the current RHS code has returned, the phase will be ended as soon as possible if the JAPE implementation supports this feature. The method returns false if this feature is not supported or if it is known that ending the phase prematurely is not possible, true otherwise.

Specified by:
endPhase in interface ActionContext
Returns:
true if ending the phase prematurely is supported, false otherwise

isPhaseEnded

public boolean isPhaseEnded()

setPhaseEnded

public void setPhaseEnded(boolean isended)