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 aRawDocument
into filter events.This class implements the
IPipelineStep
interface for a step that takes aRawDocument
and to generate its corresponding events either: a providedIFilter
implementation, 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 void
cancel()
Cancel processing on this pipeline.void
destroy()
Executes any cleanup code for this step.String
getDescription()
Gets a short localizable description of what this step does.String
getName()
Gets the localizable name of this step.Event
handleEvent(Event event)
Processes each event sent though the pipeline.boolean
isDone()
void
setFilter(IFilter filter)
void
setFilterConfigurationId(String filterConfigId)
void
setFilterConfigurationMapper(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:IPipelineStep
Gets the localizable name of this step.- Returns:
- the localizable name of this step.
-
getDescription
public String getDescription()
Description copied from interface:IPipelineStep
Gets 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:IPipelineStep
Processes each event sent though the pipeline.- Specified by:
handleEvent
in interfaceIPipelineStep
- Overrides:
handleEvent
in classBasePipelineStep
- Parameters:
event
- the event to process.- Returns:
- the event to pass down the pipeline.
-
isDone
public boolean isDone()
Description copied from interface:IPipelineStep
Steps that can generateEvent
s such asIFilter
s return false until no more events can be created. Steps which do not createEvent
s always return true.- Specified by:
isDone
in interfaceIPipelineStep
- Overrides:
isDone
in classBasePipelineStep
- Returns:
- false if can generate more events, true otherwise.
-
destroy
public void destroy()
Description copied from interface:IPipelineStep
Executes any cleanup code for this step. Called once at the end of the pipeline lifecycle.- Specified by:
destroy
in interfaceIPipelineStep
- Overrides:
destroy
in classBasePipelineStep
-
cancel
public void cancel()
Description copied from interface:IPipelineStep
Cancel processing on this pipeline. EachIPipelineStep
is responsible to implement a cancel method that will interrupt long running operations- Specified by:
cancel
in interfaceIPipelineStep
- Overrides:
cancel
in classBasePipelineStep
-
-