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 theIPipelineStepinterface.
-
-
Constructor Summary
Constructors Constructor Description BasePipelineStep()
-
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.StringgetHelpLocation()Gets the relative directory location for the help of this step.IParametersgetParameters()Gets the current parameters for this step.LocaleIdgetSourceLocale()Delegate to concrete classLocaleIdgetTargetLocale()Delegate to concrete classprotected EventhandleCustom(Event event)Handles theEventType.CUSTOMevent.protected EventhandleDocumentPart(Event event)Handles theEventType.DOCUMENT_PARTevent.protected EventhandleEndBatch(Event event)Handles theEventType.END_BATCHevent.protected EventhandleEndBatchItem(Event event)Handles theEventType.END_BATCH_ITEMevent.protected EventhandleEndDocument(Event event)Handles theEventType.END_DOCUMENTevent.protected EventhandleEndGroup(Event event)Handles theEventType.END_GROUPevent.protected EventhandleEndSubDocument(Event event)Handles theEventType.END_SUBDOCUMENTevent.protected EventhandleEndSubfilter(Event event)EventhandleEvent(Event event)Processes each event sent though the pipeline.protected EventhandleMultiEvent(Event event)Handles theEventType#MULTI_EVENTevent.protected EventhandlePipelineParameters(Event event)Handles theEventType#PIPELINE_PARAMETERSevent.protected EventhandleRawDocument(Event event)Handles theEventType.RAW_DOCUMENTevent.protected EventhandleStartBatch(Event event)Handles theEventType.START_BATCHevent.protected EventhandleStartBatchItem(Event event)Handles theEventType.START_BATCH_ITEMevent.protected EventhandleStartDocument(Event event)Handles theEventType.START_DOCUMENTevent.protected EventhandleStartGroup(Event event)Handles theEventType.START_GROUPevent.protected EventhandleStartSubDocument(Event event)Handles theEventType.START_SUBDOCUMENTevent.protected EventhandleStartSubfilter(Event event)protected EventhandleTextUnit(Event event)Handles theEventType.TEXT_UNITevent.booleanisDone()booleanisLastOutputStep()Is this step the last step with output in the pipeline?voidsetLastOutputStep(boolean isLastStep)Tell the step if it is the last one on the pipeline with output.voidsetParameters(IParameters params)Sets new parameters for this step.voidsetSourceLocale(LocaleId sourceLocale)Delegate to concrete classvoidsetTargetLocale(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:IPipelineStepGets the current parameters for this step.- Specified by:
getParametersin 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:IPipelineStepSets new parameters for this step.- Specified by:
setParametersin interfaceIPipelineStep- Parameters:
params- the new parameters to use.
-
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- Returns:
- false if can generate more events, true otherwise.
-
getHelpLocation
public String getHelpLocation()
Description copied from interface:IPipelineStepGets 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:
getHelpLocationin interfaceIPipelineStep- Returns:
- the relative directory location for the help of this step.
-
getSourceLocale
public LocaleId getSourceLocale()
Description copied from interface:IPipelineStepDelegate to concrete class- Specified by:
getSourceLocalein interfaceIPipelineStep- Returns:
- LocaleId
-
setSourceLocale
public void setSourceLocale(LocaleId sourceLocale)
Description copied from interface:IPipelineStepDelegate to concrete class- Specified by:
setSourceLocalein interfaceIPipelineStep
-
getTargetLocale
public LocaleId getTargetLocale()
Description copied from interface:IPipelineStepDelegate to concrete class- Specified by:
getTargetLocalein interfaceIPipelineStep- Returns:
- LocaleId
-
setTargetLocale
public void setTargetLocale(LocaleId targetLocale)
- Specified by:
setTargetLocalein interfaceIPipelineStep
-
handleEvent
public Event handleEvent(Event event)
Description copied from interface:IPipelineStepProcesses each event sent though the pipeline.- Specified by:
handleEventin interfaceIPipelineStep- Parameters:
event- the event to process.- Returns:
- the event to pass down the pipeline.
-
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
-
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
-
isLastOutputStep
public boolean isLastOutputStep()
Description copied from interface:IPipelineStepIs this step the last step with output in the pipeline?- Specified by:
isLastOutputStepin interfaceIPipelineStep- Returns:
- true if last step with output, false otherwise.
-
setLastOutputStep
public void setLastOutputStep(boolean isLastStep)
Description copied from interface:IPipelineStepTell the step if it is the last one on the pipeline with output.- Specified by:
setLastOutputStepin interfaceIPipelineStep- Parameters:
isLastStep- true if last step with output, false otherwise.
-
handleStartBatch
protected Event handleStartBatch(Event event)
Handles theEventType.START_BATCHevent.- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleEndBatch
protected Event handleEndBatch(Event event)
Handles theEventType.END_BATCHevent.- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleStartBatchItem
protected Event handleStartBatchItem(Event event)
Handles theEventType.START_BATCH_ITEMevent.- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleEndBatchItem
protected Event handleEndBatchItem(Event event)
Handles theEventType.END_BATCH_ITEMevent.- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleRawDocument
protected Event handleRawDocument(Event event)
Handles theEventType.RAW_DOCUMENTevent.- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleStartDocument
protected Event handleStartDocument(Event event)
Handles theEventType.START_DOCUMENTevent.- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleEndDocument
protected Event handleEndDocument(Event event)
Handles theEventType.END_DOCUMENTevent.- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleStartSubDocument
protected Event handleStartSubDocument(Event event)
Handles theEventType.START_SUBDOCUMENTevent.- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleEndSubDocument
protected Event handleEndSubDocument(Event event)
Handles theEventType.END_SUBDOCUMENTevent.- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleStartGroup
protected Event handleStartGroup(Event event)
Handles theEventType.START_GROUPevent.- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleEndGroup
protected Event handleEndGroup(Event event)
Handles theEventType.END_GROUPevent.- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleTextUnit
protected Event handleTextUnit(Event event)
Handles theEventType.TEXT_UNITevent.- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleDocumentPart
protected Event handleDocumentPart(Event event)
Handles theEventType.DOCUMENT_PARTevent.- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleCustom
protected Event handleCustom(Event event)
Handles theEventType.CUSTOMevent.- Parameters:
event- event to handle.- Returns:
- the event returned.
-
handleMultiEvent
protected Event handleMultiEvent(Event event)
Handles theEventType#MULTI_EVENTevent.- Parameters:
event- event to handle.- Returns:
- the event returned.
-
-