Class FWLoopProcessor
java.lang.Object
net.simplace.pipe.control.FWProcessor
net.simplace.pipe.control.FWLoopProcessor
- Direct Known Subclasses:
CreateSessionProcessor, LoopCounterProcessor, LoopSimModelRunProcessor, LoopSystemscenarioProcessor
Base class of looping processors, which run a given pipeline
${PipeID} (default
counterPipe) several times, once per entry of a loop list or map.
Within the looped pipeline the following parameters are set:
runCount- total number of runsCountand<looplist>.count- number of the current run, starting at${startIndex}(default 1)<looplist>.loop- the current list entry (map key)<looplist>.loopvalue- for maps, the current map valuethreadNumber- number of the thread running the pipeline
"first,next,last") or
comma-separated with = in braces for maps ("{first=firstvalue,next=nextvalue}").
Further parameters:
separateLoops(true|false) - iftrue, every run works on its own copy of the parameters; otherwise the parameters created in a run are passed to the next run and finally to the outputthreadCount- number of parallel threads (default 1); more than one forces separate runsparameterlist- comma-separated names of parameters written to the output after the loop
- Author:
- Andreas Enders
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intNumber of loops, from parameterrunCount(default 1).protected MapMap to loop over (key = loop entry, value = loop value).protected StringID of the pipeline to be looped.protected booleanIftrue, every run works on its own copy of the parameters.Fields inherited from class FWProcessor
iAllreadyLoopedCount, iContainer, iInObservable, iObservable, iProgressTasks -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanChecks that the loop pipeline (PipeID, defaultcounterPipe) exists.protected booleanCan be overridden to perform semantic checks on the output afterFWProcessor.process().clone()Creates a new instance of the same class with the same container, configuration, if-expression and end-of-pipe flag.intvoidInitialises the loop count (fromrunCount, with parameter tokens replaced) and theseparateLoopsflag.protected booleaninterveneRunLoop(net.simplace.core.FWObservable observable) Can be overridden to change the parameters of a run before it is started.protected final net.simplace.core.FWObservablerunLoop(String aLoopListParam, Map<?, Object> aLoopObjectMap, net.simplace.core.FWObservable aObservable) Runs the loop pipeline once per entry ofaLoopObjectMap, sequentially or inthreadCountparallel threads, and writes the results to the output (see class description).Methods inherited from class FWProcessor
containsParameter, createProcessor, createProcessor, fireTaskEvent, getAllStringInParameters, getConfiguration, getInitialParameters, getInParameter, getInParameter, getInParameters, getNewProgressTask, getOutParameter, getOutParameterKeys, getPipeLine, getProgressTask, getStringInParameter, getStringInParameter, getSystemID, hasConfiguration, isEndOfPipe, pipe, process, removeOutParameter, setConfiguration, setEndOfPipeFlag, setInitialParameters, setInParameterMap, setLoopedCount, setOutParameter, setStateOfTask, setStateProgressing, toXML
-
Field Details
-
iLoopCount
protected int iLoopCountNumber of loops, from parameterrunCount(default 1). -
iLoopPipeId
ID of the pipeline to be looped. -
iSeparateRuns
protected boolean iSeparateRunsIftrue, every run works on its own copy of the parameters. -
iLoopMap
Map to loop over (key = loop entry, value = loop value).
-
-
Constructor Details
-
FWLoopProcessor
public FWLoopProcessor()
-
-
Method Details
-
clone
Description copied from class:FWProcessorCreates a new instance of the same class with the same container, configuration, if-expression and end-of-pipe flag. The list of progress tasks and the map of initial parameters are shared with the original on purpose: the progress view adds one task per clone to the shared list (FWProcessor.getNewProgressTask()), and each clone uses its task by its loop count; access to the list is synchronized. The initial parameters are not changed after the pipeline is created.- Overrides:
clonein classFWProcessor
-
runLoop
protected final net.simplace.core.FWObservable runLoop(String aLoopListParam, Map<?, Object> aLoopObjectMap, net.simplace.core.FWObservable aObservable) throws PipeLineExceptionRuns the loop pipeline once per entry ofaLoopObjectMap, sequentially or inthreadCountparallel threads, and writes the results to the output (see class description). To be called by subclasses fromFWProcessor.process().- Parameters:
aLoopListParam- name of the loop list parameter, used as prefix for.loop,.loopvalueand.countaLoopObjectMap- entries to loop over (key = loop entry, value = loop value ornull)aObservable- the incoming parameters- Returns:
- the resulting parameters (for non separated runs those of the last run)
- Throws:
PipeLineException- if the loop pipeline is not found or a run fails
-
interveneRunLoop
protected boolean interveneRunLoop(net.simplace.core.FWObservable observable) Can be overridden to change the parameters of a run before it is started.- Parameters:
observable- the parameters of the run- Returns:
trueto run the pipeline,falseto skip this run; the default returnstrue
-
checkInParameterMap
protected boolean checkInParameterMap()Checks that the loop pipeline (PipeID, defaultcounterPipe) exists.- Overrides:
checkInParameterMapin classFWProcessor- Returns:
trueif the pipeline exists
-
checkOutParameterMap
protected boolean checkOutParameterMap()Description copied from class:FWProcessorCan be overridden to perform semantic checks on the output afterFWProcessor.process().- Overrides:
checkOutParameterMapin classFWProcessor- Returns:
trueif the output is valid; the default returnstrue
-
getLoopCount
public int getLoopCount()- Returns:
- the number of loops (parameter
runCount)
-
getLoopPipeID
- Returns:
- the id of the loop pipeline: the initial parameter
PipeIDif such a pipeline exists, otherwisecounterPipeif it exists, otherwisenull
-
initLoop
-
getLoopMap
- Returns:
- the map to loop over
-