net.sf.okapi.common.resource

## Class MultiEvent

- java.lang.Object
- - net.sf.okapi.common.resource.MultiEvent

- All Implemented Interfaces:
    java.lang.Iterable<Event>, IResource

      public class MultiEvent
      extends java.lang.Object
      implements IResource, java.lang.Iterable<Event>

  Special resource that holds one or more events.

- - ### Field Summary

    - ### Fields inherited from interface net.sf.okapi.common.IResource

      `COPY_ALL, COPY_CONTENT, COPY_PROPERTIES, COPY_SEGMENTATION, COPY_SEGMENTED_CONTENT, CREATE_EMPTY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MultiEvent()` Creates a new empty MultiEvent object.
    `MultiEvent(java.util.List<Event> events)` Creates a new MultiEvent object with a list of given events.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addEvent(Event event)` Adds an event to this object.
    `void` | `addEvent(Event event, int index)` Inserts an event in this object at the specified position.
    `<A extends IAnnotation> A` | `getAnnotation(java.lang.Class<A> annotationType)` Gets the annotation object for a given class for this resource.
    `java.lang.Iterable<IAnnotation>` | `getAnnotations()` Gets the iterable list of the annotations for this resource.
    `java.lang.String` | `getId()` Gets the identifier of the resource.
    `ISkeleton` | `getSkeleton()` Always throws an exception as there is never a skeleton associated to a RawDocument.
    `boolean` | `isPropagateAsSingleEvent()` Do we send this `Event` by itself or does the `Pipeline` break the individual Events and end them singly.
    `java.util.Iterator<Event>` | `iterator()` Creates an iterator for the events in this resource.
    `void` | `setAnnotation(IAnnotation annotation)` Sets an annotation object for this resource.
    `void` | `setId(java.lang.String id)` Sets the identifier of this resource.
    `void` | `setPropagateAsSingleEvent(boolean propagateAsSingleEvent)` Set Propagate As Single Event flag.
    `void` | `setSkeleton(ISkeleton skeleton)` This method has no effect as there is never a skeleton for a Document.
    `int` | `size()` Returns the number of events in this object.

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

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

- - ### Constructor Detail

    - #### MultiEvent

          public MultiEvent()

      Creates a new empty MultiEvent object.

    - #### MultiEvent

          public MultiEvent(java.util.List<Event> events)

      Creates a new MultiEvent object with a list of given events.
      Parameters:
        `events` - the list of initial events.

  - ### Method Detail

    - #### addEvent

          public void addEvent(Event event)

      Adds an event to this object.
      Parameters:
        `event` - the event to add.

    - #### addEvent

          public void addEvent(Event event,
                      int index)

      Inserts an event in this object at the specified position.
      Parameters:
        `event` - the event to insert.
        `index` - index at which the event is to be inserted.

    - #### getAnnotation

          public <A extends IAnnotation> A getAnnotation(java.lang.Class<A> annotationType)

      Description copied from interface: `IResource`
      Gets the annotation object for a given class for this resource.
      Specified by:
        `getAnnotation` in interface `IResource`
      Parameters:
        `annotationType` - the class of the annotation object to retrieve.
      Returns:
        the annotation for the given class for this resource.

    - #### getId

          public java.lang.String getId()

      Description copied from interface: `IResource`
      Gets the identifier of the resource. This identifier is unique per extracted document and by type of resource. This value is filter-specific. It and may be different from one extraction of the same document to the next. It can a sequential number or not, incremental or not, and it can be not a number. It has no correspondence in the source document ("IDs" coming from the source document are "names" and not available for all resources).
      Specified by:
        `getId` in interface `IResource`
      Returns:
        the identifier of this resource.

    - #### getSkeleton

          public ISkeleton getSkeleton()

      Always throws an exception as there is never a skeleton associated to a RawDocument.
      Specified by:
        `getSkeleton` in interface `IResource`
      Returns:
        never returns.
      Throws:
        `OkapiNotImplementedException`

    - #### setAnnotation

          public void setAnnotation(IAnnotation annotation)

      Description copied from interface: `IResource`
      Sets an annotation object for this resource.
      Specified by:
        `setAnnotation` in interface `IResource`
      Parameters:
        `annotation` - the annotation object to set.

    - #### setId

          public void setId(java.lang.String id)

      Description copied from interface: `IResource`
      Sets the identifier of this resource.
      Specified by:
        `setId` in interface `IResource`
      Parameters:
        `id` - the new identifier value.
      See Also:
        `IResource.getId()`

    - #### setSkeleton

          public void setSkeleton(ISkeleton skeleton)

      This method has no effect as there is never a skeleton for a Document.
      Specified by:
        `setSkeleton` in interface `IResource`
      Parameters:
        `skeleton` - the skeleton object to set.
      Throws:
        `OkapiNotImplementedException`

    - #### iterator

          public java.util.Iterator<Event> iterator()

      Creates an iterator for the events in this resource.
      Specified by:
        `iterator` in interface `java.lang.Iterable<Event>`

    - #### setPropagateAsSingleEvent

          public void setPropagateAsSingleEvent(boolean propagateAsSingleEvent)

      Set Propagate As Single Event flag.
      Parameters:
        `propagateAsSingleEvent` -

    - #### isPropagateAsSingleEvent

          public boolean isPropagateAsSingleEvent()

      Do we send this `Event` by itself or does the `Pipeline` break the individual Events and end them singly. Default is false - we send each Event singly.
      Returns:
        true if we send the Event as-is, false to send the individual Events continued here.

    - #### getAnnotations

          public java.lang.Iterable<IAnnotation> getAnnotations()

      Description copied from interface: `IResource`
      Gets the iterable list of the annotations for this resource.
      Specified by:
        `getAnnotations` in interface `IResource`
      Returns:
        the iterable list of the annotations for this resource.

    - #### size

          public int size()

      Returns the number of events in this object.
      Returns:
        number of events