Package net.sf.okapi.common.pipeline
Class BasePipelineStep
- java.lang.Object
-
- net.sf.okapi.common.pipeline.BasePipelineStep
-
- All Implemented Interfaces:
AutoCloseable
,Function<Stream<Event>,Stream<Event>>
,IPipelineStep
- Direct Known Subclasses:
AbstractCompoundStep
,BaseCountStep
,BatchTmLeveragingStep
,BatchTranslationStep
,BOMConversionStep
,CharacterCountStep
,CharactersCheckerStep
,CharListingStep
,CleanupStep
,CodeSimplifierStep
,CodesRemovalStep
,ConvertSegmentsToTextUnitsStep
,CopyOrMoveStep
,CopySourceOnEmptyTargetStep
,CreateTargetStep
,DesegmentationStep
,DiffLeverageStep
,EncodingConversionStep
,EnrycherStep
,ExternalCommandStep
,ExtractionStep
,ExtractionStep
,ExtractionVerificationStep
,FilterEventsToRawDocumentStep
,FilterEventsWriterStep
,FormatConversionStep
,FullWidthConversionStep
,GeneralCheckerStep
,IdBasedAlignerStep
,IdBasedCopyStep
,ImageModificationStep
,InconsistencyCheckStep
,InlineCodesCheckerStep
,LengthCheckerStep
,LeveragingStep
,LineBreakConversionStep
,LocalizableCheckerStep
,MergingStep
,MergingStep
,MSBatchTranslationStep
,OriginalDocumentProtoMergerStep
,OriginalDocumentXliffMergerStep
,ParagraphAlignerStep
,PatternsCheckerStep
,PostSegmentationCodeSimplifierStep
,QualityCheckStep
,RawDocumentToFilterEventsStep
,RawDocumentToOutputStreamStep
,RawDocumentWriterStep
,RemoveTargetStep
,RepetitionAnalysisStep
,ResourceSimplifierStep
,RTFConversionStep
,SearchAndReplaceStep
,SegmentationStep
,SentenceAlignerStep
,SimpleWordCountStep
,SpaceCheckStep
,SubFilterWrapperStep
,TermExtractionStep
,TerminologyLeveragingStep
,TextModificationStep
,TMImportStep
,TokenizationStep
,TranslationComparisonStep
,TTXJoinerStep
,TTXSplitterStep
,TuFilteringStep
,UriConversionStep
,WhitespaceCorrectionStep
,XliffJoinerStep
,XliffSplitterStep
,XliffWCSplitterStep
,XMLAnalysisStep
,XMLCharFixingStep
,XMLValidationStep
,XPipelineAsStepImpl
,XSLTransformStep
public abstract class BasePipelineStep extends Object implements IPipelineStep
Abstract implementation of theIPipelineStep
interface.
-
-
Constructor Summary
Constructors Constructor Description BasePipelineStep()
-
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
getHelpLocation()
Gets the relative directory location for the help of this step.IParameters
getParameters()
Gets the current parameters for this step.LocaleId
getSourceLocale()
Delegate to concrete classLocaleId
getTargetLocale()
Delegate to concrete classprotected Event
handleCustom(Event event)
Handles theEventType.CUSTOM
event.protected Event
handleDocumentPart(Event event)
Handles theEventType.DOCUMENT_PART
event.protected Event
handleEndBatch(Event event)
Handles theEventType.END_BATCH
event.protected Event
handleEndBatchItem(Event event)
Handles theEventType.END_BATCH_ITEM
event.protected Event
handleEndDocument(Event event)
Handles theEventType.END_DOCUMENT
event.protected Event
handleEndGroup(Event event)
Handles theEventType.END_GROUP
event.protected Event
handleEndSubDocument(Event event)
Handles theEventType.END_SUBDOCUMENT
event.protected Event
handleEndSubfilter(Event event)
Event
handleEvent(Event event)
Processes each event sent though the pipeline.protected Event
handleMultiEvent(Event event)
Handles theEventType#MULTI_EVENT
event.protected Event
handlePipelineParameters(Event event)
Handles theEventType#PIPELINE_PARAMETERS
event.protected Event
handleRawDocument(Event event)
Handles theEventType.RAW_DOCUMENT
event.protected Event
handleStartBatch(Event event)
Handles theEventType.START_BATCH
event.protected Event
handleStartBatchItem(Event event)
Handles theEventType.START_BATCH_ITEM
event.protected Event
handleStartDocument(Event event)
Handles theEventType.START_DOCUMENT
event.protected Event
handleStartGroup(Event event)
Handles theEventType.START_GROUP
event.protected Event
handleStartSubDocument(Event event)
Handles theEventType.START_SUBDOCUMENT
event.protected Event
handleStartSubfilter(Event event)
protected Event
handleTextUnit(Event event)
Handles theEventType.TEXT_UNIT
event.boolean
isDone()
boolean
isLastOutputStep()
Is this step the last step with output in the pipeline?void
setLastOutputStep(boolean isLastStep)
Tell the step if it is the last one on the pipeline with output.void
setParameters(IParameters params)
Sets new parameters for this step.void
setSourceLocale(LocaleId sourceLocale)
Delegate to concrete classvoid
setTargetLocale(LocaleId targetLocale)
-
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, getDescription, getName, handleStream
-
-
-
-
Method Detail
-
getParameters
public IParameters getParameters()
Description copied from interface:IPipelineStep
Gets the current parameters for this step.- Specified by:
getParameters
in interfaceIPipelineStep
- Returns:
- the current parameters for this step or null if there are no parameters.
-
setParameters
public void setParameters(IParameters params)
Description copied from interface:IPipelineStep
Sets new parameters for this step.- Specified by:
setParameters
in interfaceIPipelineStep
- Parameters:
params
- the new parameters to use.
-
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
- Returns:
- false if can generate more events, true otherwise.
-
getHelpLocation
public String getHelpLocation()
Description copied from interface:IPipelineStep
Gets the relative directory location for the help of this step. The main help file for the step must be at that location and its name must be the name of the class implementing the step in lowercase with a .html extension.- Specified by:
getHelpLocation
in interfaceIPipelineStep
- Returns:
- the relative directory location for the help of this step.
-
getSourceLocale
public LocaleId getSourceLocale()
Description copied from interface:IPipelineStep
Delegate to concrete class- Specified by:
getSourceLocale
in interfaceIPipelineStep
- Returns:
- LocaleId
-
setSourceLocale
public void setSourceLocale(LocaleId sourceLocale)
Description copied from interface:IPipelineStep
Delegate to concrete class- Specified by:
setSourceLocale
in interfaceIPipelineStep
-
getTargetLocale
public LocaleId getTargetLocale()
Description copied from interface:IPipelineStep
Delegate to concrete class- Specified by:
getTargetLocale
in interfaceIPipelineStep
- Returns:
- LocaleId
-
setTargetLocale
public void setTargetLocale(LocaleId targetLocale)
- Specified by:
setTargetLocale
in interfaceIPipelineStep
-
handleEvent
public Event handleEvent(Event event)
Description copied from interface:IPipelineStep
Processes each event sent though the pipeline.- Specified by:
handleEvent
in interfaceIPipelineStep
- Parameters:
event
- the event to process.- Returns:
- the event to pass down the pipeline.
-
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
-
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
-
isLastOutputStep
public boolean isLastOutputStep()
Description copied from interface:IPipelineStep
Is this step the last step with output in the pipeline?- Specified by:
isLastOutputStep
in interfaceIPipelineStep
- Returns:
- true if last step with output, false otherwise.
-
setLastOutputStep
public void setLastOutputStep(boolean isLastStep)
Description copied from interface:IPipelineStep
Tell the step if it is the last one on the pipeline with output.- Specified by:
setLastOutputStep
in interfaceIPipelineStep
- Parameters:
isLastStep
- true if last step with output, false otherwise.
-
handleStartBatch
protected Event handleStartBatch(Event event)
Handles theEventType.START_BATCH
event.- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleEndBatch
protected Event handleEndBatch(Event event)
Handles theEventType.END_BATCH
event.- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleStartBatchItem
protected Event handleStartBatchItem(Event event)
Handles theEventType.START_BATCH_ITEM
event.- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleEndBatchItem
protected Event handleEndBatchItem(Event event)
Handles theEventType.END_BATCH_ITEM
event.- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleRawDocument
protected Event handleRawDocument(Event event)
Handles theEventType.RAW_DOCUMENT
event.- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleStartDocument
protected Event handleStartDocument(Event event)
Handles theEventType.START_DOCUMENT
event.- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleEndDocument
protected Event handleEndDocument(Event event)
Handles theEventType.END_DOCUMENT
event.- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleStartSubDocument
protected Event handleStartSubDocument(Event event)
Handles theEventType.START_SUBDOCUMENT
event.- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleEndSubDocument
protected Event handleEndSubDocument(Event event)
Handles theEventType.END_SUBDOCUMENT
event.- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleStartGroup
protected Event handleStartGroup(Event event)
Handles theEventType.START_GROUP
event.- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleEndGroup
protected Event handleEndGroup(Event event)
Handles theEventType.END_GROUP
event.- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleTextUnit
protected Event handleTextUnit(Event event)
Handles theEventType.TEXT_UNIT
event.- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleDocumentPart
protected Event handleDocumentPart(Event event)
Handles theEventType.DOCUMENT_PART
event.- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleCustom
protected Event handleCustom(Event event)
Handles theEventType.CUSTOM
event.- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
handleMultiEvent
protected Event handleMultiEvent(Event event)
Handles theEventType#MULTI_EVENT
event.- Parameters:
event
- event to handle.- Returns:
- the event returned.
-
-