Package net.sf.okapi.steps.common
Class RawDocumentToFilterEventsStep
- java.lang.Object
-
- net.sf.okapi.common.pipeline.BasePipelineStep
-
- net.sf.okapi.steps.common.RawDocumentToFilterEventsStep
-
- All Implemented Interfaces:
AutoCloseable,Function<Stream<Event>,Stream<Event>>,IPipelineStep
public class RawDocumentToFilterEventsStep extends BasePipelineStep
Converts aRawDocumentinto filter events.This class implements the
IPipelineStepinterface for a step that takes aRawDocumentand to generate its corresponding events either: a providedIFilterimplementation, or the filter configuration mapper accessible through the pipeline's context.This step can also work with the filters that generates multiple documents.
-
-
Constructor Summary
Constructors Constructor Description RawDocumentToFilterEventsStep()Creates a new RawDocumentToFilterEventsStep object.RawDocumentToFilterEventsStep(IFilter filter)Creates a new RawDocumentToFilterEventsStep object with a given filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancel processing on this pipeline.voiddestroy()Executes any cleanup code for this step.StringgetDescription()Gets a short localizable description of what this step does.StringgetName()Gets the localizable name of this step.EventhandleEvent(Event event)Processes each event sent though the pipeline.booleanisDone()voidsetFilter(IFilter filter)voidsetFilterConfigurationId(String filterConfigId)voidsetFilterConfigurationMapper(IFilterConfigurationMapper fcMapper)-
Methods inherited from class net.sf.okapi.common.pipeline.BasePipelineStep
getHelpLocation, getParameters, getSourceLocale, getTargetLocale, handleCustom, handleDocumentPart, handleEndBatch, handleEndBatchItem, handleEndDocument, handleEndGroup, handleEndSubDocument, handleEndSubfilter, handleMultiEvent, handlePipelineParameters, handleRawDocument, handleStartBatch, handleStartBatchItem, handleStartDocument, handleStartGroup, handleStartSubDocument, handleStartSubfilter, handleTextUnit, isLastOutputStep, setLastOutputStep, setParameters, setSourceLocale, setTargetLocale
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.okapi.common.pipeline.IPipelineStep
apply, close, handleStream
-
-
-
-
Constructor Detail
-
RawDocumentToFilterEventsStep
public RawDocumentToFilterEventsStep()
Creates a new RawDocumentToFilterEventsStep object. This constructor is needed to be able to instantiate an object from newInstance()
-
RawDocumentToFilterEventsStep
public RawDocumentToFilterEventsStep(IFilter filter)
Creates a new RawDocumentToFilterEventsStep object with a given filter. Use this constructor to create an object that is using a filter set using the one provided here, or usingsetFilter(IFilter), not using the filter configuration mapper of the pipeline context.- Parameters:
filter- the filter to set.
-
-
Method Detail
-
setFilter
public void setFilter(IFilter filter)
-
setFilterConfigurationMapper
public void setFilterConfigurationMapper(IFilterConfigurationMapper fcMapper)
-
setFilterConfigurationId
public void setFilterConfigurationId(String filterConfigId)
-
getName
public String getName()
Description copied from interface:IPipelineStepGets the localizable name of this step.- Returns:
- the localizable name of this step.
-
getDescription
public String getDescription()
Description copied from interface:IPipelineStepGets a short localizable description of what this step does.- Returns:
- the text of a short description of what this step does.
-
handleEvent
public Event handleEvent(Event event)
Description copied from interface:IPipelineStepProcesses each event sent though the pipeline.- Specified by:
handleEventin interfaceIPipelineStep- Overrides:
handleEventin classBasePipelineStep- Parameters:
event- the event to process.- Returns:
- the event to pass down the pipeline.
-
isDone
public boolean isDone()
Description copied from interface:IPipelineStepSteps that can generateEvents such asIFilters return false until no more events can be created. Steps which do not createEvents always return true.- Specified by:
isDonein interfaceIPipelineStep- Overrides:
isDonein classBasePipelineStep- Returns:
- false if can generate more events, true otherwise.
-
destroy
public void destroy()
Description copied from interface:IPipelineStepExecutes any cleanup code for this step. Called once at the end of the pipeline lifecycle.- Specified by:
destroyin interfaceIPipelineStep- Overrides:
destroyin classBasePipelineStep
-
cancel
public void cancel()
Description copied from interface:IPipelineStepCancel processing on this pipeline. EachIPipelineStepis responsible to implement a cancel method that will interrupt long running operations- Specified by:
cancelin interfaceIPipelineStep- Overrides:
cancelin classBasePipelineStep
-
-