gate.creole
Class ConditionalSerialController
java.lang.Object
gate.util.AbstractFeatureBearer
gate.creole.AbstractResource
gate.creole.AbstractController
gate.creole.SerialController
gate.creole.ConditionalSerialController
- All Implemented Interfaces:
- Controller, ConditionalController, CustomDuplication, CreoleListener, Executable, ProcessingResource, Resource, Benchmarkable, FeatureBearer, NameBearer, Serializable, EventListener
- Direct Known Subclasses:
- ConditionalSerialAnalyserController
@CreoleResource(name="Conditional Pipeline",
comment="A simple serial controller for conditionally run PRs.",
helpURL="http://gate.ac.uk/userguide/sec:developer:cond")
public class ConditionalSerialController
- extends SerialController
- implements ConditionalController
Execute a list of PRs serially. For each PR a running strategy is stored
which decides whether the PR will be run always, never or upon a condition
being satisfied.
This controller uses AnalyserRunningStrategy
objects as running
strategies and they only work with LanguageAnalyser
s so the PRs that
are not analysers will get a default "run always" strategy.
- See Also:
- Serialized Form
Field Summary |
protected List |
strategiesList
The list of running strategies for the member PRs. |
Methods inherited from class gate.creole.SerialController |
checkParameters, datastoreClosed, datastoreCreated, datastoreOpened, executeImpl, getPRs, getPrTimeMap, resetPrTimeMap, resourceLoaded, resourceRenamed, resourceUnloaded, set, setPRs |
Methods inherited from class gate.creole.AbstractController |
addControllerListener, addProgressListener, addStatusListener, execute, fireProcessFinished, fireProgressChanged, fireResourceAdded, fireResourceRemoved, fireStatusChanged, getBenchmarkId, getControllerAwarePRs, getOffendingPocessingResources, init, interrupt, isInterrupted, reInit, removeControllerListener, removeProgressListener, removeStatusListener, setBenchmarkId |
Methods inherited from class gate.creole.AbstractResource |
checkParameterValues, getBeanInfo, getInitParameterValues, getInitParameterValues, getName, getParameterValue, getParameterValue, getParameterValues, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
strategiesList
protected List strategiesList
- The list of running strategies for the member PRs.
ConditionalSerialController
public ConditionalSerialController()
getRunningStrategies
public Collection getRunningStrategies()
- Description copied from interface:
ConditionalController
- Gets the collection of running strategies for the contained PRs.
The iterator of this collection should return the running strategies in
sync with the iterator for the getPRs() method of
Controller
.
- Specified by:
getRunningStrategies
in interface ConditionalController
- Returns:
- a Collection object.
add
public void add(int index,
ProcessingResource pr)
- Set a PR at a specified location.
The running strategy defaults to run always.
- Overrides:
add
in class SerialController
- Parameters:
index
- the position for the PRpr
- the PR to be set.
add
public void add(ProcessingResource pr)
- Add a PR to the end of the execution list.
- Overrides:
add
in class SerialController
- Parameters:
pr
- the PR to be added.
remove
public ProcessingResource remove(int index)
- Overrides:
remove
in class SerialController
remove
public boolean remove(ProcessingResource pr)
- Overrides:
remove
in class SerialController
setRunningStrategy
public void setRunningStrategy(int index,
AnalyserRunningStrategy strategy)
setRunningStrategies
public void setRunningStrategies(Collection strategies)
- Populates this controller with the appropiate running strategies from a
collection of running strategies
(optional operation).
Controllers that are serializable must implement this method needed by GATE
to restore their contents.
- Specified by:
setRunningStrategies
in interface ConditionalController
- Throws:
UnsupportedOperationException
- if the setPRs method
is not supported by this controller.
runComponent
protected void runComponent(int componentIndex)
throws ExecutionException
- Executes a
ProcessingResource
.
- Overrides:
runComponent
in class SerialController
- Throws:
ExecutionException
cleanup
public void cleanup()
- Cleans the internal data and prepares this object to be collected
- Specified by:
cleanup
in interface Resource
- Overrides:
cleanup
in class SerialController
duplicate
public Resource duplicate(Factory.DuplicationContext ctx)
throws ResourceInstantiationException
- Custom duplication method for conditional controllers to handle
duplicating the running strategies.
- Specified by:
duplicate
in interface CustomDuplication
- Overrides:
duplicate
in class SerialController
- Parameters:
ctx
- the current duplication context
.
If an implementation of this method needs to duplicate any
other resources as part of the custom duplication process
it should pass this context back to the two-argument form of
Factory.duplicate
rather than using the single-argument form.
- Returns:
- an independent copy of this resource.
- Throws:
ResourceInstantiationException