Package net.sf.okapi.common.pipeline
Class Pipeline
- java.lang.Object
-
- net.sf.okapi.common.pipeline.Pipeline
-
- All Implemented Interfaces:
IObservable,IObserver,IPipeline
- Direct Known Subclasses:
XPipeline
public class Pipeline extends Object implements IPipeline, IObservable, IObserver
Default implementations of theIPipelineinterface.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_ID
-
Constructor Summary
Constructors Constructor Description Pipeline()Creates a new Pipeline object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddObserver(IObserver observer)Attaches a observer to the Observable.voidaddStep(IPipelineStep step)Adds a step to this pipeline.voidcancel()Cancels processing on this pipeline.voidclearSteps()Remove all theIPipelineSteps from the pipeline.intcountObservers()Counts how many Observers were attached to this class.voiddeleteObserver(IObserver observer)Detaches a previously attached observer to the observable.voiddeleteObservers()Detaches all previously attached observer to the observable.voiddestroy()Frees all resources from all steps in this pipeline.voidendBatch()Finishes a batch of inputs.StringgetId()Get the Pipelines identifier.List<IObserver>getObservers()Returns list of observers registered with the Observable.PipelineReturnValuegetState()Gets the current pipeline state.List<IPipelineStep>getSteps()Gets the list of all steps in this pipeline.voidnotifyObservers()Notifies all attached observers about changes in the observable.voidnotifyObservers(Object arg)Notifies all attached observers about changes in the observable.voidprocess(Event input)voidprocess(RawDocument input)StartsIPipelineprocessing with aRawDocumentas input.voidsetId(String id)Set the pipelines identifier.voidstartBatch()Starts a batch of inputs.voidupdate(IObservable o, Object arg)This method is called whenever the observed object is changed.
-
-
-
Field Detail
-
DEFAULT_ID
public static final String DEFAULT_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
startBatch
public void startBatch()
Description copied from interface:IPipelineStarts a batch of inputs.- Specified by:
startBatchin interfaceIPipeline
-
endBatch
public void endBatch()
Description copied from interface:IPipelineFinishes a batch of inputs.
-
addStep
public void addStep(IPipelineStep step)
Description copied from interface:IPipelineAdds a step to this pipeline. Steps are executed in the order they are added.
-
getSteps
public List<IPipelineStep> getSteps()
Description copied from interface:IPipelineGets the list of all steps in this pipeline.
-
cancel
public void cancel()
Description copied from interface:IPipelineCancels processing on this pipeline.
-
getState
public PipelineReturnValue getState()
Description copied from interface:IPipelineGets the current pipeline state.
-
process
public void process(RawDocument input)
Description copied from interface:IPipelineStartsIPipelineprocessing with aRawDocumentas input. This is a convenience method that callsIPipeline.process(Event).
-
destroy
public void destroy()
Description copied from interface:IPipelineFrees all resources from all steps in this pipeline.
-
clearSteps
public void clearSteps()
Description copied from interface:IPipelineRemove all theIPipelineSteps from the pipeline. Also calls the destroy() method on each step.- Specified by:
clearStepsin interfaceIPipeline
-
getId
public String getId()
Description copied from interface:IPipelineGet the Pipelines identifier.
-
setId
public void setId(String id)
Description copied from interface:IPipelineSet the pipelines identifier.
-
update
public void update(IObservable o, Object arg)
Description copied from interface:IObserverThis method is called whenever the observed object is changed.
-
addObserver
public void addObserver(IObserver observer)
Description copied from interface:IObservableAttaches a observer to the Observable. After attachment the observer gets informed about changes in the Observable.- Specified by:
addObserverin interfaceIObservable- Parameters:
observer- The observer to attach to the observable
-
countObservers
public int countObservers()
Description copied from interface:IObservableCounts how many Observers were attached to this class.- Specified by:
countObserversin interfaceIObservable- Returns:
- the number of Observers
- See Also:
IObserver
-
deleteObserver
public void deleteObserver(IObserver observer)
Description copied from interface:IObservableDetaches a previously attached observer to the observable. After detachment the observer does no longer receive change notifications from the observable.- Specified by:
deleteObserverin interfaceIObservable- Parameters:
observer- The observer to detach from the observable
-
notifyObservers
public void notifyObservers()
Description copied from interface:IObservableNotifies all attached observers about changes in the observable.- Specified by:
notifyObserversin interfaceIObservable
-
notifyObservers
public void notifyObservers(Object arg)
Description copied from interface:IObservableNotifies all attached observers about changes in the observable.- Specified by:
notifyObserversin interfaceIObservable- Parameters:
arg- an arbitrary Object to be passed to the Observer
-
deleteObservers
public void deleteObservers()
Description copied from interface:IObservableDetaches all previously attached observer to the observable. After detachment observers do not longer receive change notifications from the observable.- Specified by:
deleteObserversin interfaceIObservable
-
getObservers
public List<IObserver> getObservers()
Description copied from interface:IObservableReturns list of observers registered with the Observable. List returned is unmodifiable list.- Specified by:
getObserversin interfaceIObservable- Returns:
- list of observers
-
-