net.sf.okapi.common

## Class Event

- java.lang.Object
- - net.sf.okapi.common.Event

-     public class Event
      extends java.lang.Object

  Represents an event generated by a filter that implements IFilter.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Event` | `END_BATCH_EVENT`
    `static Event` | `NOOP_EVENT`
    `static Event` | `START_BATCH_EVENT`
    `static Event` | `START_BATCH_ITEM_EVENT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Event()`
    `Event(EventType filterEventType)` Creates a new event without any associated resource.
    `Event(EventType filterEventType, IResource resource)` Creates a new event with an associated resource.
    `Event(EventType filterEventType, IResource resource, ISkeleton skeleton)` Creates a new event with an associated resource and a skeleton object.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `DocumentPart` | `getDocumentPart()` Convenience method returns the `IResource` as a `DocumentPart`.
    `Ending` | `getEndGroup()` Convenience method returns the `IResource` as a `Ending`.
    `Ending` | `getEnding()` Convenience method returns the Ending resource.
    `EndSubfilter` | `getEndSubfilter()` Convenience method returns the `IResource` as a `EndSubfilter`.
    `EventType` | `getEventType()` Gets the type of this event.
    `MultiEvent` | `getMultiEvent()` Convenience method returns the `IResource` as a `MultiEvent`.
    `PipelineParameters` | `getPipelineParameters()` Convenience method returns the `IResource` as a `PipelineParameters`.
    `RawDocument` | `getRawDocument()` Convenience method returns the `IResource` as a `RawDocument`.
    `IResource` | `getResource()` Gets the resource associated to this event.
    `StartDocument` | `getStartDocument()` Convenience method returns the `IResource` as a `StartDocument`.
    `StartGroup` | `getStartGroup()` Convenience method returns the `IResource` as a `StartGroup`.
    `StartSubDocument` | `getStartSubDocument()` Convenience method returns the `IResource` as a `StartSubDocument`.
    `StartSubfilter` | `getStartSubfilter()` Convenience method returns the `IResource` as a `StartSubfilter`.
    `ITextUnit` | `getTextUnit()` Convenience method returns the `IResource` as a `ITextUnit`.
    `boolean` | `isDocumentPart()` Convenience method to tell if this Event carries a `DocumentPart`
    `boolean` | `isEndDocument()` Convenience method to tell if this Event carries a document `Ending`
    `boolean` | `isEndGroup()` Convenience method to tell if this Event carries a group `Ending`
    `boolean` | `isEndSubDocument()` Convenience method to tell if this Event carries a sub-document `Ending`
    `boolean` | `isEndSubfilter()` Convenience method to tell if this Event is a SubFilter Group
    `boolean` | `isMultiEvent()` Convenience method to tell if this Event is a MULTI_EVENT
    `boolean` | `isNoop()`
    `boolean` | `isPipelineParametersEvent()` Indicates if this event carries a `PipelineParameters` resource.
    `boolean` | `isRawDocument()` Convenience method to tell if this Event carries a `RawDocument`
    `boolean` | `isStartBatchItem()` Convenience method to tell if this Event is START_BATCH_ITEM
    `boolean` | `isStartDocument()` Convenience method to tell if this Event carries a `StartDocument`
    `boolean` | `isStartGroup()` Convenience method to tell if this Event carries a `StartGroup`
    `boolean` | `isStartSubDocument()` Convenience method to tell if this Event carries a `StartSubDocument`
    `boolean` | `isStartSubfilter()` Convenience method to tell if this Event is a SubFilter Group
    `boolean` | `isTextUnit()` Convenience method to tell if this Event carries a `ITextUnit`
    `void` | `setEventType(EventType filterEventType)`
    `void` | `setResource(IResource resource)` Sets the resource associated to this event.
    `java.lang.String` | `toString()`

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

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

- - ### Field Detail

    - #### END_BATCH_EVENT

          public static final Event END_BATCH_EVENT

    - #### NOOP_EVENT

          public static final Event NOOP_EVENT

    - #### START_BATCH_EVENT

          public static final Event START_BATCH_EVENT

    - #### START_BATCH_ITEM_EVENT

          public static final Event START_BATCH_ITEM_EVENT

  - ### Constructor Detail

    - #### Event

          public Event()

    - #### Event

          public Event(EventType filterEventType)

      Creates a new event without any associated resource. Used for filter events that have no resources such as START and FINISH.
      Parameters:
        `filterEventType` - the type of event to create.

    - #### Event

          public Event(EventType filterEventType,
               IResource resource)

      Creates a new event with an associated resource.
      Parameters:
        `filterEventType` - the type of event to create.
        `resource` - the resource to associate to the event.

    - #### Event

          public Event(EventType filterEventType,
               IResource resource,
               ISkeleton skeleton)

      Creates a new event with an associated resource and a skeleton object.
      Parameters:
        `filterEventType` - the type of event to create.
        `resource` - the resource to associate to the event.
        `skeleton` - the skeleton to associate to the event.

  - ### Method Detail

    - #### getEventType

          public EventType getEventType()

      Gets the type of this event.
      Returns:
        the type of this event.

    - #### getResource

          public IResource getResource()

      Gets the resource associated to this event.
      Returns:
        the resource associated to this event, or null if there is none.

    - #### setResource

          public void setResource(IResource resource)

      Sets the resource associated to this event.

    - #### setEventType

          public void setEventType(EventType filterEventType)

    - #### isTextUnit

          public boolean isTextUnit()

      Convenience method to tell if this Event carries a `ITextUnit`
      Returns:
        true if `ITextUnit`, false otherwise

    - #### isDocumentPart

          public boolean isDocumentPart()

      Convenience method to tell if this Event carries a `DocumentPart`
      Returns:
        true if `DocumentPart`, false otherwise

    - #### isStartGroup

          public boolean isStartGroup()

      Convenience method to tell if this Event carries a `StartGroup`
      Returns:
        true if `StartGroup`, false otherwise

    - #### isEndGroup

          public boolean isEndGroup()

      Convenience method to tell if this Event carries a group `Ending`
      Returns:
        true if group `Ending`, false otherwise

    - #### isRawDocument

          public boolean isRawDocument()

      Convenience method to tell if this Event carries a `RawDocument`
      Returns:
        true if `RawDocument`, false otherwise

    - #### isStartDocument

          public boolean isStartDocument()

      Convenience method to tell if this Event carries a `StartDocument`
      Returns:
        true if `StartDocument`, false otherwise

    - #### isEndDocument

          public boolean isEndDocument()

      Convenience method to tell if this Event carries a document `Ending`
      Returns:
        true if document `Ending`, false otherwise

    - #### isStartBatchItem

          public boolean isStartBatchItem()

      Convenience method to tell if this Event is START_BATCH_ITEM
      Returns:
        true if START_BATCH_ITEM, false otherwise

    - #### isStartSubDocument

          public boolean isStartSubDocument()

      Convenience method to tell if this Event carries a `StartSubDocument`
      Returns:
        true if `StartSubDocument`, false otherwise

    - #### isEndSubDocument

          public boolean isEndSubDocument()

      Convenience method to tell if this Event carries a sub-document `Ending`
      Returns:
        true if sub-document `Ending`, false otherwise

    - #### isMultiEvent

          public boolean isMultiEvent()

      Convenience method to tell if this Event is a MULTI_EVENT
      Returns:
        true if `MultiEvent`, false otherwise

    - #### isStartSubfilter

          public boolean isStartSubfilter()

      Convenience method to tell if this Event is a SubFilter Group
      Returns:
        true if `StartSubfilter`, false otherwise

    - #### isEndSubfilter

          public boolean isEndSubfilter()

      Convenience method to tell if this Event is a SubFilter Group
      Returns:
        true if `StartSubfilter`, false otherwise

    - #### getTextUnit

          public ITextUnit getTextUnit()

      Convenience method returns the `IResource` as a `ITextUnit`. The caller should confirm the `Event` type using isTextUnit before calling this method.
      Returns:
        the `ITextUnit`
      Throws:
        `OkapiUnexpectedResourceTypeException` - if the `IResource` is not a `ITextUnit`

    - #### getDocumentPart

          public DocumentPart getDocumentPart()

      Convenience method returns the `IResource` as a `DocumentPart`. The caller should confirm the `Event` type using isDocumentPart before calling this method.
      Returns:
        the `DocumentPart`
      Throws:
        `OkapiUnexpectedResourceTypeException` - if the `IResource` is not a `DocumentPart`

    - #### getStartGroup

          public StartGroup getStartGroup()

      Convenience method returns the `IResource` as a `StartGroup`. The caller should confirm the `Event` type using isStartGroup before calling this method.
      Returns:
        the `StartGroup`
      Throws:
        `OkapiUnexpectedResourceTypeException` - if the `IResource` is not a `StartGroup`

    - #### getEndGroup

          public Ending getEndGroup()

      Convenience method returns the `IResource` as a `Ending`. The caller should confirm the `Event` type using isEndGroup before calling this method.
      Returns:
        the `Ending`
      Throws:
        `OkapiUnexpectedResourceTypeException` - if the `IResource` is not a `Ending`

    - #### getEnding

          public Ending getEnding()

      Convenience method returns the Ending resource.
      Returns:
        the Ending resource.

    - #### getRawDocument

          public RawDocument getRawDocument()

      Convenience method returns the `IResource` as a `RawDocument`. The caller should confirm the `Event` type using isRawDocument before calling this method.
      Returns:
        the `RawDocument`
      Throws:
        `OkapiUnexpectedResourceTypeException` - if the `IResource` is not a `RawDocument`

    - #### getStartSubDocument

          public StartSubDocument getStartSubDocument()

      Convenience method returns the `IResource` as a `StartSubDocument`. The caller should confirm the `Event` type using isStartSubDocument before calling this method.
      Returns:
        the `StartSubDocument`
      Throws:
        `OkapiUnexpectedResourceTypeException` - if the `IResource` is not a `StartSubDocument`

    - #### getStartDocument

          public StartDocument getStartDocument()

      Convenience method returns the `IResource` as a `StartDocument`. The caller should confirm the `Event` type using isStartDocument before calling this method.
      Returns:
        the `StartDocument`
      Throws:
        `OkapiUnexpectedResourceTypeException` - if the `IResource` is not a `StartDocument`

    - #### getStartSubfilter

          public StartSubfilter getStartSubfilter()

      Convenience method returns the `IResource` as a `StartSubfilter`. The caller should confirm the `Event` type using isStartSubfilter before calling this method.
      Returns:
        the `StartSubfilter`
      Throws:
        `OkapiUnexpectedResourceTypeException` - if the `IResource` is not a `StartSubfilter`

    - #### getEndSubfilter

          public EndSubfilter getEndSubfilter()

      Convenience method returns the `IResource` as a `EndSubfilter`. The caller should confirm the `Event` type using isEndSubfilter before calling this method.
      Returns:
        the `EndSubfilter`
      Throws:
        `OkapiUnexpectedResourceTypeException` - if the `IResource` is not a `EndSubfilter`

    - #### getMultiEvent

          public MultiEvent getMultiEvent()

      Convenience method returns the `IResource` as a `MultiEvent`. The caller should confirm the `EventType` using isMultiEvent before calling this method.
      Returns:
        the `MultiEvent`
      Throws:
        `OkapiUnexpectedResourceTypeException` - if the `IResource` is not a `MultiEvent`

    - #### isPipelineParametersEvent

          public boolean isPipelineParametersEvent()

      Indicates if this event carries a `PipelineParameters` resource.
      Returns:
        true if this event carries a `PipelineParameters` resource, false otherwise.

    - #### getPipelineParameters

          public PipelineParameters getPipelineParameters()

      Convenience method returns the `IResource` as a `PipelineParameters`.
      Returns:
        the `PipelineParameters`
      Throws:
        `OkapiUnexpectedResourceTypeException` - if the `IResource` is not a `PipelineParameters`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### isNoop

          public boolean isNoop()