Package net.sf.okapi.common
Class Event
- java.lang.Object
-
- net.sf.okapi.common.Event
-
public class Event extends Object
Represents an event generated by a filter that implements IFilter.
-
-
Constructor Summary
Constructors Constructor 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EventcreateEndBatchEvent()Convenience method that creates anEventType.END_BATCHeventstatic EventcreateEndBatchItemEvent()Convenience method that creates anEventType.END_BATCH_ITEMeventstatic EventcreateNoopEvent()Convenience method that creates anEventType.NO_OPeventstatic EventcreateStartBatchEvent()Convenience method that creates anEventType.START_BATCHeventstatic EventcreateStartBatchItemEvent()Convenience method that creates anEventType.START_BATCH_ITEMeventDocumentPartgetDocumentPart()Convenience method returns theIResourceas aDocumentPart.EndinggetEndGroup()EndinggetEnding()Convenience method returns the Ending resource.EndSubfiltergetEndSubfilter()Convenience method returns theIResourceas aEndSubfilter.EventTypegetEventType()Gets the type of this event.MultiEventgetMultiEvent()Convenience method returns theIResourceas aMultiEvent.PipelineParametersgetPipelineParameters()Convenience method returns theIResourceas aPipelineParameters.RawDocumentgetRawDocument()Convenience method returns theIResourceas aRawDocument.IResourcegetResource()Gets the resource associated to this event.StartDocumentgetStartDocument()Convenience method returns theIResourceas aStartDocument.StartGroupgetStartGroup()Convenience method returns theIResourceas aStartGroup.StartSubDocumentgetStartSubDocument()Convenience method returns theIResourceas aStartSubDocument.StartSubfiltergetStartSubfilter()Convenience method returns theIResourceas aStartSubfilter.ITextUnitgetTextUnit()booleanisDocumentPart()Convenience method to tell if this Event carries aDocumentPartbooleanisEndDocument()Convenience method to tell if this Event carries a documentEndingbooleanisEndGroup()Convenience method to tell if this Event carries a groupEndingbooleanisEndSubDocument()Convenience method to tell if this Event carries a sub-documentEndingbooleanisEndSubfilter()Convenience method to tell if this Event is a SubFilter GroupbooleanisMultiEvent()Convenience method to tell if this Event is a MULTI_EVENTbooleanisNoop()booleanisPipelineParametersEvent()Indicates if this event carries aPipelineParametersresource.booleanisRawDocument()Convenience method to tell if this Event carries aRawDocumentbooleanisStartBatchItem()Convenience method to tell if this Event is START_BATCH_ITEMbooleanisStartDocument()Convenience method to tell if this Event carries aStartDocumentbooleanisStartGroup()Convenience method to tell if this Event carries aStartGroupbooleanisStartSubDocument()Convenience method to tell if this Event carries aStartSubDocumentbooleanisStartSubfilter()Convenience method to tell if this Event is a SubFilter GroupbooleanisTextUnit()Convenience method to tell if this Event carries aITextUnitvoidsetEventType(EventType filterEventType)voidsetResource(IResource resource)Sets the resource associated to this event.StringtoString()
-
-
-
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.- Parameters:
resource- the new resource.
-
setEventType
public void setEventType(EventType filterEventType)
-
isTextUnit
public boolean isTextUnit()
Convenience method to tell if this Event carries aITextUnit- Returns:
- true if
ITextUnit, false otherwise
-
isDocumentPart
public boolean isDocumentPart()
Convenience method to tell if this Event carries aDocumentPart- Returns:
- true if
DocumentPart, false otherwise
-
isStartGroup
public boolean isStartGroup()
Convenience method to tell if this Event carries aStartGroup- Returns:
- true if
StartGroup, false otherwise
-
isEndGroup
public boolean isEndGroup()
Convenience method to tell if this Event carries a groupEnding- Returns:
- true if group
Ending, false otherwise
-
isRawDocument
public boolean isRawDocument()
Convenience method to tell if this Event carries aRawDocument- Returns:
- true if
RawDocument, false otherwise
-
isStartDocument
public boolean isStartDocument()
Convenience method to tell if this Event carries aStartDocument- Returns:
- true if
StartDocument, false otherwise
-
isEndDocument
public boolean isEndDocument()
Convenience method to tell if this Event carries a documentEnding- 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 aStartSubDocument- Returns:
- true if
StartSubDocument, false otherwise
-
isEndSubDocument
public boolean isEndSubDocument()
Convenience method to tell if this Event carries a sub-documentEnding- 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 theIResourceas aITextUnit. The caller should confirm theEventtype using isTextUnit before calling this method.- Returns:
- the
ITextUnit - Throws:
OkapiUnexpectedResourceTypeException- if theIResourceis not aITextUnit
-
getDocumentPart
public DocumentPart getDocumentPart()
Convenience method returns theIResourceas aDocumentPart. The caller should confirm theEventtype using isDocumentPart before calling this method.- Returns:
- the
DocumentPart - Throws:
OkapiUnexpectedResourceTypeException- if theIResourceis not aDocumentPart
-
getStartGroup
public StartGroup getStartGroup()
Convenience method returns theIResourceas aStartGroup. The caller should confirm theEventtype using isStartGroup before calling this method.- Returns:
- the
StartGroup - Throws:
OkapiUnexpectedResourceTypeException- if theIResourceis not aStartGroup
-
getEndGroup
public Ending getEndGroup()
Convenience method returns theIResourceas aEnding. The caller should confirm theEventtype using isEndGroup before calling this method.- Returns:
- the
Ending - Throws:
OkapiUnexpectedResourceTypeException- if theIResourceis not aEnding
-
getEnding
public Ending getEnding()
Convenience method returns the Ending resource.- Returns:
- the Ending resource.
-
getRawDocument
public RawDocument getRawDocument()
Convenience method returns theIResourceas aRawDocument. The caller should confirm theEventtype using isRawDocument before calling this method.- Returns:
- the
RawDocument - Throws:
OkapiUnexpectedResourceTypeException- if theIResourceis not aRawDocument
-
getStartSubDocument
public StartSubDocument getStartSubDocument()
Convenience method returns theIResourceas aStartSubDocument. The caller should confirm theEventtype using isStartSubDocument before calling this method.- Returns:
- the
StartSubDocument - Throws:
OkapiUnexpectedResourceTypeException- if theIResourceis not aStartSubDocument
-
getStartDocument
public StartDocument getStartDocument()
Convenience method returns theIResourceas aStartDocument. The caller should confirm theEventtype using isStartDocument before calling this method.- Returns:
- the
StartDocument - Throws:
OkapiUnexpectedResourceTypeException- if theIResourceis not aStartDocument
-
getStartSubfilter
public StartSubfilter getStartSubfilter()
Convenience method returns theIResourceas aStartSubfilter. The caller should confirm theEventtype using isStartSubfilter before calling this method.- Returns:
- the
StartSubfilter - Throws:
OkapiUnexpectedResourceTypeException- if theIResourceis not aStartSubfilter
-
getEndSubfilter
public EndSubfilter getEndSubfilter()
Convenience method returns theIResourceas aEndSubfilter. The caller should confirm theEventtype using isEndSubfilter before calling this method.- Returns:
- the
EndSubfilter - Throws:
OkapiUnexpectedResourceTypeException- if theIResourceis not aEndSubfilter
-
getMultiEvent
public MultiEvent getMultiEvent()
Convenience method returns theIResourceas aMultiEvent. The caller should confirm theEventTypeusing isMultiEvent before calling this method.- Returns:
- the
MultiEvent - Throws:
OkapiUnexpectedResourceTypeException- if theIResourceis not aMultiEvent
-
isPipelineParametersEvent
public boolean isPipelineParametersEvent()
Indicates if this event carries aPipelineParametersresource.- Returns:
- true if this event carries a
PipelineParametersresource, false otherwise.
-
getPipelineParameters
public PipelineParameters getPipelineParameters()
Convenience method returns theIResourceas aPipelineParameters.- Returns:
- the
PipelineParameters - Throws:
OkapiUnexpectedResourceTypeException- if theIResourceis not aPipelineParameters
-
isNoop
public boolean isNoop()
-
createEndBatchEvent
public static final Event createEndBatchEvent()
Convenience method that creates anEventType.END_BATCHevent
-
createEndBatchItemEvent
public static final Event createEndBatchItemEvent()
Convenience method that creates anEventType.END_BATCH_ITEMevent
-
createNoopEvent
public static final Event createNoopEvent()
Convenience method that creates anEventType.NO_OPevent
-
createStartBatchEvent
public static final Event createStartBatchEvent()
Convenience method that creates anEventType.START_BATCHevent
-
createStartBatchItemEvent
public static final Event createStartBatchItemEvent()
Convenience method that creates anEventType.START_BATCH_ITEMevent
-
-