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 theIPipeline
interface.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_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 void
addObserver(IObserver observer)
Attaches a observer to the Observable.void
addStep(IPipelineStep step)
Adds a step to this pipeline.void
cancel()
Cancels processing on this pipeline.void
clearSteps()
Remove all theIPipelineStep
s from the pipeline.int
countObservers()
Counts how many Observers were attached to this class.void
deleteObserver(IObserver observer)
Detaches a previously attached observer to the observable.void
deleteObservers()
Detaches all previously attached observer to the observable.void
destroy()
Frees all resources from all steps in this pipeline.void
endBatch()
Finishes a batch of inputs.String
getId()
Get the Pipelines identifier.List<IObserver>
getObservers()
Returns list of observers registered with the Observable.PipelineReturnValue
getState()
Gets the current pipeline state.List<IPipelineStep>
getSteps()
Gets the list of all steps in this pipeline.void
notifyObservers()
Notifies all attached observers about changes in the observable.void
notifyObservers(Object arg)
Notifies all attached observers about changes in the observable.void
process(Event input)
void
process(RawDocument input)
StartsIPipeline
processing with aRawDocument
as input.void
setId(String id)
Set the pipelines identifier.void
startBatch()
Starts a batch of inputs.void
update(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:IPipeline
Starts a batch of inputs.- Specified by:
startBatch
in interfaceIPipeline
-
endBatch
public void endBatch()
Description copied from interface:IPipeline
Finishes a batch of inputs.
-
addStep
public void addStep(IPipelineStep step)
Description copied from interface:IPipeline
Adds a step to this pipeline. Steps are executed in the order they are added.
-
getSteps
public List<IPipelineStep> getSteps()
Description copied from interface:IPipeline
Gets the list of all steps in this pipeline.
-
cancel
public void cancel()
Description copied from interface:IPipeline
Cancels processing on this pipeline.
-
getState
public PipelineReturnValue getState()
Description copied from interface:IPipeline
Gets the current pipeline state.
-
process
public void process(RawDocument input)
Description copied from interface:IPipeline
StartsIPipeline
processing with aRawDocument
as input. This is a convenience method that callsIPipeline.process(Event)
.
-
destroy
public void destroy()
Description copied from interface:IPipeline
Frees all resources from all steps in this pipeline.
-
clearSteps
public void clearSteps()
Description copied from interface:IPipeline
Remove all theIPipelineStep
s from the pipeline. Also calls the destroy() method on each step.- Specified by:
clearSteps
in interfaceIPipeline
-
getId
public String getId()
Description copied from interface:IPipeline
Get the Pipelines identifier.
-
setId
public void setId(String id)
Description copied from interface:IPipeline
Set the pipelines identifier.
-
update
public void update(IObservable o, Object arg)
Description copied from interface:IObserver
This method is called whenever the observed object is changed.
-
addObserver
public void addObserver(IObserver observer)
Description copied from interface:IObservable
Attaches a observer to the Observable. After attachment the observer gets informed about changes in the Observable.- Specified by:
addObserver
in interfaceIObservable
- Parameters:
observer
- The observer to attach to the observable
-
countObservers
public int countObservers()
Description copied from interface:IObservable
Counts how many Observers were attached to this class.- Specified by:
countObservers
in interfaceIObservable
- Returns:
- the number of Observers
- See Also:
IObserver
-
deleteObserver
public void deleteObserver(IObserver observer)
Description copied from interface:IObservable
Detaches a previously attached observer to the observable. After detachment the observer does no longer receive change notifications from the observable.- Specified by:
deleteObserver
in interfaceIObservable
- Parameters:
observer
- The observer to detach from the observable
-
notifyObservers
public void notifyObservers()
Description copied from interface:IObservable
Notifies all attached observers about changes in the observable.- Specified by:
notifyObservers
in interfaceIObservable
-
notifyObservers
public void notifyObservers(Object arg)
Description copied from interface:IObservable
Notifies all attached observers about changes in the observable.- Specified by:
notifyObservers
in interfaceIObservable
- Parameters:
arg
- an arbitrary Object to be passed to the Observer
-
deleteObservers
public void deleteObservers()
Description copied from interface:IObservable
Detaches all previously attached observer to the observable. After detachment observers do not longer receive change notifications from the observable.- Specified by:
deleteObservers
in interfaceIObservable
-
getObservers
public List<IObserver> getObservers()
Description copied from interface:IObservable
Returns list of observers registered with the Observable. List returned is unmodifiable list.- Specified by:
getObservers
in interfaceIObservable
- Returns:
- list of observers
-
-