gate.creole
Class AnalyserRunningStrategy
java.lang.Object
gate.creole.AnalyserRunningStrategy
- All Implemented Interfaces:
- RunningStrategy
public class AnalyserRunningStrategy
- extends Object
- implements RunningStrategy
A type running strategy that decides whether the associated PR needs to be
run based on the value of a specified feature on the document that the PR
needs to be run on.
It can only be used for LanguageAnalyser
s because it needs the
document the PR will run on.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
pr
protected LanguageAnalyser pr
runMode
protected int runMode
featureName
protected String featureName
featureValue
protected String featureValue
AnalyserRunningStrategy
public AnalyserRunningStrategy(LanguageAnalyser pr,
int runMode,
String featureName,
String featureValue)
shouldRun
public boolean shouldRun()
- If the runMode is
RunningStrategy.RUN_ALWAYS
returns true.
If the runMode is RunningStrategy.RUN_NEVER
returns false.
If the runMode is RunningStrategy.RUN_CONDITIONAL
:
- if the document is null returns false
- if the document features are null
- if the document features are not null
- if
featureName
is null returns true
- if
featureName
is not null and the document features contain
such a feature returns true if the value of the feature is
featureValue
and false otherwise.
- Specified by:
shouldRun
in interface RunningStrategy
- Returns:
- a boolean value.
getRunMode
public int getRunMode()
- Description copied from interface:
RunningStrategy
- Returns the run mode (see
RunningStrategy.RUN_ALWAYS
, RunningStrategy.RUN_NEVER
,
RunningStrategy.RUN_CONDITIONAL
).
- Specified by:
getRunMode
in interface RunningStrategy
- Returns:
- and int value.
setRunMode
public void setRunMode(int mode)
setFeatureName
public void setFeatureName(String name)
setFeatureValue
public void setFeatureValue(String value)
getFeatureName
public String getFeatureName()
getFeatureValue
public String getFeatureValue()
getPR
public ProcessingResource getPR()
- Description copied from interface:
RunningStrategy
- Gets the associated ProcessingResource.
- Specified by:
getPR
in interface RunningStrategy
- Returns:
- a
ProcessingResource
value.
setProcessingResource
public void setProcessingResource(ProcessingResource pr)