Package net.sf.okapi.common.resource
Class MultiEvent
- java.lang.Object
-
- net.sf.okapi.common.resource.MultiEvent
-
- All Implemented Interfaces:
Cloneable,Iterable<Event>,IResource,IWithAnnotations,IWithProperties,IWithSkeleton
public class MultiEvent extends Object implements IResource, 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 Description MultiEvent()Creates a new empty MultiEvent object.MultiEvent(List<Event> events)Creates a new MultiEvent object with a list of given events.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEvent(Event event)Adds an event to this object.voidaddEvent(Event event, int index)Inserts an event in this object at the specified position.<A extends IAnnotation>
AgetAnnotation(Class<A> annotationType)Gets the annotation object for a given class for this resource.AnnotationsgetAnnotations()StringgetId()Gets the identifier of the resource.Map<String,Property>getProperties()booleanisPropagateAsSingleEvent()Do we send thisEventby itself or does thePipelinebreak the individual Events and end them singly.Iterator<Event>iterator()Creates an iterator for the events in this resource.voidsetId(String id)Sets the identifier of this resource.voidsetPropagateAsSingleEvent(boolean propagateAsSingleEvent)Set Propagate As Single Event flag.intsize()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
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface net.sf.okapi.common.resource.IWithAnnotations
annotationIterator, clear, getAnnotationsTypesAsSet, hasAnnotation, hasAnnotations, remove, setAnnotation
-
Methods inherited from interface net.sf.okapi.common.resource.IWithProperties
getProperty, getPropertyNames, hasProperty, propertyIterator, removeProperty, setProperty
-
Methods inherited from interface net.sf.okapi.common.resource.IWithSkeleton
getSkeleton, setSkeleton
-
-
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:IResourceGets 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).
-
setId
public void setId(String id)
Description copied from interface:IResourceSets the identifier of this resource.- Specified by:
setIdin interfaceIResource- Parameters:
id- the new identifier value.- See Also:
IResource.getId()
-
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(Class<A> annotationType)
Description copied from interface:IWithAnnotationsGets the annotation object for a given class for this resource.- Specified by:
getAnnotationin interfaceIWithAnnotations- Returns:
-
setPropagateAsSingleEvent
public void setPropagateAsSingleEvent(boolean propagateAsSingleEvent)
Set Propagate As Single Event flag.- Parameters:
propagateAsSingleEvent- true if we want to propagate as single event.
-
isPropagateAsSingleEvent
public boolean isPropagateAsSingleEvent()
Do we send thisEventby itself or does thePipelinebreak 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.
-
size
public int size()
Returns the number of events in this object.- Returns:
- number of events
-
getProperties
public Map<String,Property> getProperties()
- Specified by:
getPropertiesin interfaceIWithProperties- Returns:
Mapof properties for the implementer of interface
-
getAnnotations
public Annotations getAnnotations()
- Specified by:
getAnnotationsin interfaceIWithAnnotations- Returns:
Annotationsfor the implementer of interface
-
-