Package net.sf.okapi.common.pipeline
Interface IPipelineStep
-
- All Known Subinterfaces:
ICallableStep<T>
,IWorkQueueStep<T>
- All Known Implementing Classes:
AbstractCompoundStep
,AltAnnotationBasedCountStep
,BaseCountStep
,BasePipelineStep
,BatchTmLeveragingStep
,BatchTranslationStep
,BOMConversionStep
,CharacterCountStep
,CharactersCheckerStep
,CharListingStep
,CleanupStep
,CodeSimplifierStep
,CodesRemovalStep
,ConcordanceCharacterCountStep
,ConcordanceWordCountStep
,ConvertSegmentsToTextUnitsStep
,CopyOrMoveStep
,CopySourceOnEmptyTargetStep
,CreateTargetStep
,DesegmentationStep
,DiffLeverageStep
,EncodingConversionStep
,EnrycherStep
,ExactDocumentContextMatchCharacterCountStep
,ExactDocumentContextMatchWordCountStep
,ExactLocalContextMatchCharacterCountStep
,ExactLocalContextMatchWordCountStep
,ExactMatchCharacterCountStep
,ExactMatchWordCountStep
,ExactPreviousVersionMatchCharacterCountStep
,ExactPreviousVersionMatchWordCountStep
,ExactRepairedCharacterCountStep
,ExactRepairedWordCountStep
,ExactStructuralMatchCharacterCountStep
,ExactStructuralMatchWordCountStep
,ExactTextOnlyCharacterCountStep
,ExactTextOnlyPreviousVersionMatchCharacterCountStep
,ExactTextOnlyPreviousVersionMatchWordCountStep
,ExactTextOnlyUniqueIdMatchCharacterCountStep
,ExactTextOnlyUniqueIdMatchWordCountStep
,ExactTextOnlyWordCountStep
,ExactUniqueIdMatchCharacterCountStep
,ExactUniqueIdMatchWordCountStep
,ExternalCommandStep
,ExtractionStep
,ExtractionStep
,ExtractionVerificationStep
,FilterEventsToRawDocumentStep
,FilterEventsWriterStep
,FormatConversionStep
,FullWidthConversionStep
,FuzzyMatchCharacterCountStep
,FuzzyMatchWordCountStep
,FuzzyPreviousVersionMatchCharacterCountStep
,FuzzyPreviousVersionMatchWordCountStep
,FuzzyRepairedCharacterCountStep
,FuzzyRepairedWordCountStep
,FuzzyUniqueIdMatchCharacterCountStep
,FuzzyUniqueIdMatchWordCountStep
,GeneralCheckerStep
,GMXAlphanumericOnlyTextUnitCharacterCountStep
,GMXAlphanumericOnlyTextUnitWordCountStep
,GMXExactMatchedCharacterCountStep
,GMXExactMatchedWordCountStep
,GMXFuzzyMatchCharacterCountStep
,GMXFuzzyMatchWordCountStep
,GMXLeveragedMatchedCharacterCountStep
,GMXLeveragedMatchedWordCountStep
,GMXMeasurementOnlyTextUnitCharacterCountStep
,GMXMeasurementOnlyTextUnitWordCountStep
,GMXNumericOnlyTextUnitCharacterCountStep
,GMXNumericOnlyTextUnitWordCountStep
,GMXProtectedCharacterCountStep
,GMXProtectedWordCountStep
,GMXRepetitionMatchedCharacterCountStep
,GMXRepetitionMatchedWordCountStep
,IdBasedAlignerStep
,IdBasedCopyStep
,ImageModificationStep
,InconsistencyCheckStep
,InlineCodesCheckerStep
,LengthCheckerStep
,LeveragingStep
,LineBreakConversionStep
,LocalizableCheckerStep
,MergingStep
,MergingStep
,MSBatchTranslationStep
,MTCharacterCountStep
,MTWordCountStep
,OriginalDocumentProtoMergerStep
,OriginalDocumentXliffMergerStep
,ParagraphAlignerStep
,PatternsCheckerStep
,PhraseAssembledCharacterCountStep
,PhraseAssembledWordCountStep
,PostSegmentationCodeSimplifierStep
,QualityCheckStep
,RawDocumentToFilterEventsStep
,RawDocumentToOutputStreamStep
,RawDocumentWriterStep
,RemoveTargetStep
,RepetitionAnalysisStep
,ResourceSimplifierStep
,RTFConversionStep
,ScopingReportStep
,SearchAndReplaceStep
,SegmentationStep
,SentenceAlignerStep
,SimpleWordCountStep
,SpaceCheckStep
,SubFilterWrapperStep
,TermExtractionStep
,TerminologyLeveragingStep
,TextModificationStep
,TMImportStep
,TokenCharacterCountStep
,TokenCountStep
,TokenizationStep
,TranslationComparisonStep
,TTXJoinerStep
,TTXSplitterStep
,TuFilteringStep
,UriConversionStep
,WhitespaceCorrectionStep
,WordCountStep
,XliffJoinerStep
,XliffSplitterStep
,XliffWCSplitterStep
,XMLAnalysisStep
,XMLCharFixingStep
,XMLValidationStep
,XPipeline
,XPipelineAsStepImpl
,XPipelineStep
,XSLTransformStep
public interface IPipelineStep extends AutoCloseable, Function<Stream<Event>,Stream<Event>>
Common set of methods for a step within aIPipeline
pipeline.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default Stream<Event>
apply(Stream<Event> events)
void
cancel()
Cancel processing on this pipeline.default void
close()
default void
destroy()
Deprecated.useclose()
methodString
getDescription()
Gets a short localizable description of what this step does.String
getHelpLocation()
Gets the relative directory location for the help of this step.String
getName()
Gets the localizable name of this step.IParameters
getParameters()
Gets the current parameters for this step.default LocaleId
getSourceLocale()
Delegate to concrete classdefault LocaleId
getTargetLocale()
Delegate to concrete classEvent
handleEvent(Event event)
Processes each event sent though the pipeline.default Stream<Event>
handleStream(Event event)
Processes a stream of events sent though the pipeline.boolean
isDone()
boolean
isLastOutputStep()
Is this step the last step with output in the pipeline?static <T> T
runPipelineSteps(List<Function<T,T>> functions, T t)
Given a collection ofIPipelineStep
execute them in sequence given a Streaminput. 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.default void
setSourceLocale(LocaleId sourceLocale)
Delegate to concrete classdefault void
setTargetLocale(LocaleId targetLocale)
-
-
-
Method Detail
-
runPipelineSteps
static <T> T runPipelineSteps(List<Function<T,T>> functions, T t)
Given a collection ofIPipelineStep
execute them in sequence given a Streaminput. Functions take the output of the previous step as the input of the current step etc. Similar to running a pipeline. - Parameters:
functions
- List of Function, Stream > t
- Stream- Returns:
- Stream
-
getParameters
IParameters getParameters()
Gets the current parameters for this step.- Returns:
- the current parameters for this step or null if there are no parameters.
-
setParameters
void setParameters(IParameters params)
Sets new parameters for this step.- Parameters:
params
- the new parameters to use.
-
getName
String getName()
Gets the localizable name of this step.- Returns:
- the localizable name of this step.
-
getDescription
String getDescription()
Gets a short localizable description of what this step does.- Returns:
- the text of a short description of what this step does.
-
getHelpLocation
String getHelpLocation()
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.- Returns:
- the relative directory location for the help of this step.
-
handleEvent
Event handleEvent(Event event)
Processes each event sent though the pipeline.- Parameters:
event
- the event to process.- Returns:
- the event to pass down the pipeline.
-
handleStream
default Stream<Event> handleStream(Event event)
Processes a stream of events sent though the pipeline.- Parameters:
event
- the event to process.- Returns:
- the stream to pass down the pipeline.
-
isDone
boolean isDone()
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.- Returns:
- false if can generate more events, true otherwise.
-
destroy
@Deprecated default void destroy()
Deprecated.useclose()
methodExecutes any cleanup code for this step. Called once at the end of the pipeline lifecycle.
-
close
default void close()
- Specified by:
close
in interfaceAutoCloseable
-
cancel
void cancel()
Cancel processing on this pipeline. EachIPipelineStep
is responsible to implement a cancel method that will interrupt long running operations
-
isLastOutputStep
boolean isLastOutputStep()
Is this step the last step with output in the pipeline?- Returns:
- true if last step with output, false otherwise.
-
setLastOutputStep
void setLastOutputStep(boolean isLastStep)
Tell the step if it is the last one on the pipeline with output.- Parameters:
isLastStep
- true if last step with output, false otherwise.
-
getSourceLocale
default LocaleId getSourceLocale()
Delegate to concrete class- Returns:
- LocaleId
-
setSourceLocale
default void setSourceLocale(LocaleId sourceLocale)
Delegate to concrete class- Parameters:
sourceLocale
-
-
getTargetLocale
default LocaleId getTargetLocale()
Delegate to concrete class- Returns:
- LocaleId
-
setTargetLocale
default void setTargetLocale(LocaleId targetLocale)
-
-