net.sf.okapi.common.pipeline

## Class Pipeline

- java.lang.Object
- - net.sf.okapi.common.pipeline.Pipeline

- All Implemented Interfaces:
    IObservable, IObserver, IPipeline

      public class Pipeline
      extends java.lang.Object
      implements IPipeline, IObservable, IObserver

  Default implementations of the `IPipeline` interface.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `DEFAULT_ID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Pipeline()` Creates a new Pipeline object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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 the `IPipelineStep`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.
    `java.lang.String` | `getId()` Get the Pipelines identifier.
    `java.util.List<IObserver>` | `getObservers()` Returns list of observers registered with the Observable.
    `PipelineReturnValue` | `getState()` Gets the current pipeline state.
    `java.util.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(java.lang.Object arg)` Notifies all attached observers about changes in the observable.
    `void` | `process(Event input)` Starts `IPipeline` processing with a `Event` as input.
    `void` | `process(RawDocument input)` Starts `IPipeline` processing with a `RawDocument` as input.
    `void` | `setId(java.lang.String id)` Set the pipelines identifier.
    `void` | `startBatch()` Starts a batch of inputs.
    `void` | `update(IObservable o, java.lang.Object arg)` This method is called whenever the observed object is changed.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_ID

          public static final java.lang.String DEFAULT_ID

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Pipeline

          public Pipeline()

      Creates a new Pipeline object.

  - ### Method Detail

    - #### startBatch

          public void startBatch()

      Description copied from interface: `IPipeline`
      Starts a batch of inputs.
      Specified by:
        `startBatch` in interface `IPipeline`

    - #### endBatch

          public void endBatch()

      Description copied from interface: `IPipeline`
      Finishes a batch of inputs.
      Specified by:
        `endBatch` in interface `IPipeline`

    - #### 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.
      Specified by:
        `addStep` in interface `IPipeline`
      Parameters:
        `step` - the step to add.

    - #### getSteps

          public java.util.List<IPipelineStep> getSteps()

      Description copied from interface: `IPipeline`
      Gets the list of all steps in this pipeline.
      Specified by:
        `getSteps` in interface `IPipeline`
      Returns:
        a list of all steps in this pipeline, the list may be empty.

    - #### cancel

          public void cancel()

      Description copied from interface: `IPipeline`
      Cancels processing on this pipeline.
      Specified by:
        `cancel` in interface `IPipeline`

    - #### getState

          public PipelineReturnValue getState()

      Description copied from interface: `IPipeline`
      Gets the current pipeline state.
      Specified by:
        `getState` in interface `IPipeline`
      Returns:
        the current state of the pipeline.

    - #### process

          public void process(RawDocument input)

      Description copied from interface: `IPipeline`
      Starts `IPipeline` processing with a `RawDocument` as input. This is a convenience method that calls `IPipeline.process(Event)`.
      Specified by:
        `process` in interface `IPipeline`
      Parameters:
        `input` - the RawDocument to process.

    - #### process

          public void process(Event input)

      Description copied from interface: `IPipeline`
      Starts `IPipeline` processing with a `Event` as input.
      Specified by:
        `process` in interface `IPipeline`
      Parameters:
        `input` - event that primes the `IPipeline`

    - #### destroy

          public void destroy()

      Description copied from interface: `IPipeline`
      Frees all resources from all steps in this pipeline.
      Specified by:
        `destroy` in interface `IPipeline`

    - #### clearSteps

          public void clearSteps()

      Description copied from interface: `IPipeline`
      Remove all the `IPipelineStep`s from the pipeline. Also calls the destroy() method on each step.
      Specified by:
        `clearSteps` in interface `IPipeline`

    - #### getId

          public java.lang.String getId()

      Description copied from interface: `IPipeline`
      Get the Pipelines identifier.
      Specified by:
        `getId` in interface `IPipeline`
      Returns:
        String identifier

    - #### setId

          public void setId(java.lang.String id)

      Description copied from interface: `IPipeline`
      Set the pipelines identifier.
      Specified by:
        `setId` in interface `IPipeline`
      Parameters:
        `id` - the new id of the pipeline.

    - #### update

          public void update(IObservable o,
                             java.lang.Object arg)

      Description copied from interface: `IObserver`
      This method is called whenever the observed object is changed.
      Specified by:
        `update` in interface `IObserver`
      Parameters:
        `o` - the object to be observed.
        `arg` - additional arguments.

    - #### 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 interface `IObservable`
      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 interface `IObservable`
      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 interface `IObservable`
      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 interface `IObservable`

    - #### notifyObservers

          public void notifyObservers(java.lang.Object arg)

      Description copied from interface: `IObservable`
      Notifies all attached observers about changes in the observable.
      Specified by:
        `notifyObservers` in interface `IObservable`
      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 interface `IObservable`

    - #### getObservers

          public java.util.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 interface `IObservable`
      Returns:
        list of observers