gate.creole
Class ConditionalSerialController

java.lang.Object
  extended by gate.util.AbstractFeatureBearer
      extended by gate.creole.AbstractResource
          extended by gate.creole.AbstractController
              extended by gate.creole.SerialController
                  extended by 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 LanguageAnalysers so the PRs that are not analysers will get a default "run always" strategy.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class gate.creole.AbstractController
AbstractController.InternalStatusListener, AbstractController.IntervalProgressListener
 
Field Summary
protected  List strategiesList
          The list of running strategies for the member PRs.
 
Fields inherited from class gate.creole.SerialController
log, prList, prof, prTimeMap, sListener, timeMap
 
Fields inherited from class gate.creole.AbstractController
benchmarkFeatures, benchmarkID, interrupted
 
Fields inherited from class gate.creole.AbstractResource
name
 
Fields inherited from class gate.util.AbstractFeatureBearer
features
 
Constructor Summary
ConditionalSerialController()
           
 
Method Summary
 void add(int index, ProcessingResource pr)
          Set a PR at a specified location.
 void add(ProcessingResource pr)
          Add a PR to the end of the execution list.
 void cleanup()
          Cleans the internal data and prepares this object to be collected
 Resource duplicate(Factory.DuplicationContext ctx)
          Custom duplication method for conditional controllers to handle duplicating the running strategies.
 Collection getRunningStrategies()
          Gets the collection of running strategies for the contained PRs.
 ProcessingResource remove(int index)
           
 boolean remove(ProcessingResource pr)
           
protected  void runComponent(int componentIndex)
          Executes a ProcessingResource.
 void setRunningStrategies(Collection strategies)
          Populates this controller with the appropiate running strategies from a collection of running strategies (optional operation).
 void setRunningStrategy(int index, AnalyserRunningStrategy strategy)
           
 
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 gate.util.AbstractFeatureBearer
getFeatures, setFeatures
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gate.Controller
execute, getPRs, setPRs
 
Methods inherited from interface gate.Resource
getParameterValue, init, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures, setFeatures
 
Methods inherited from interface gate.util.NameBearer
getName, setName
 
Methods inherited from interface gate.Executable
interrupt, isInterrupted
 

Field Detail

strategiesList

protected List strategiesList
The list of running strategies for the member PRs.

Constructor Detail

ConditionalSerialController

public ConditionalSerialController()
Method Detail

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 PR
pr - 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