Package org.mwolff.command.process
Class AbstractDefaultProcessCommand<T>
- java.lang.Object
-
- org.mwolff.command.AbstractDefaultCommand<T>
-
- org.mwolff.command.chain.AbstractDefaultChainCommand<T>
-
- org.mwolff.command.process.AbstractDefaultProcessCommand<T>
-
- All Implemented Interfaces:
ChainCommand<T>
,Command<T>
,ProcessCommand<T>
- Direct Known Subclasses:
DefaultEndCommand
public abstract class AbstractDefaultProcessCommand<T> extends AbstractDefaultChainCommand<T> implements ProcessCommand<T>
Default implementation for a process-command. You may useexecuteAsProcess
for all executions of thecommand
orcommandContainer
.
-
-
Field Summary
Fields Modifier and Type Field Description protected String
processID
protected List<Transition>
transitionList
-
Fields inherited from interface org.mwolff.command.process.ProcessCommand
END
-
-
Constructor Summary
Constructors Constructor Description AbstractDefaultProcessCommand()
AbstractDefaultProcessCommand(String processID)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTransition(Transition transition)
Optional<String>
executeAsProcess(String startCommand, T context)
Execute a command as a process.Optional<String>
findNext(String next)
Finds the next command with the processID next.String
getProcessID()
Gets the process ID of the command.List<Transition>
getTransitionList()
void
setProcessID(String processID)
Sets the process ID of the command-
Methods inherited from class org.mwolff.command.chain.AbstractDefaultChainCommand
executeCommandAsChain
-
Methods inherited from class org.mwolff.command.AbstractDefaultCommand
executeCommand
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.mwolff.command.chain.ChainCommand
executeCommandAsChain
-
Methods inherited from interface org.mwolff.command.Command
executeCommand
-
Methods inherited from interface org.mwolff.command.process.ProcessCommand
executeAsProcess
-
-
-
-
Field Detail
-
processID
protected String processID
-
transitionList
protected List<Transition> transitionList
-
-
Constructor Detail
-
AbstractDefaultProcessCommand
public AbstractDefaultProcessCommand()
-
AbstractDefaultProcessCommand
public AbstractDefaultProcessCommand(String processID)
-
-
Method Detail
-
addTransition
public void addTransition(Transition transition)
- Specified by:
addTransition
in interfaceProcessCommand<T>
-
findNext
public Optional<String> findNext(String next)
Description copied from interface:ProcessCommand
Finds the next command with the processID next.- Specified by:
findNext
in interfaceProcessCommand<T>
- Parameters:
next
- The process id to find.- Returns:
- The process id of the next command
-
getProcessID
public String getProcessID()
Description copied from interface:ProcessCommand
Gets the process ID of the command.- Specified by:
getProcessID
in interfaceProcessCommand<T>
- Returns:
- The process ID
-
getTransitionList
public List<Transition> getTransitionList()
- Specified by:
getTransitionList
in interfaceProcessCommand<T>
-
setProcessID
public void setProcessID(String processID)
Description copied from interface:ProcessCommand
Sets the process ID of the command- Specified by:
setProcessID
in interfaceProcessCommand<T>
- Parameters:
processID
- Sets the process id of this process command.
-
executeAsProcess
public Optional<String> executeAsProcess(String startCommand, T context)
Description copied from interface:ProcessCommand
Execute a command as a process. The result is the decision which process step should be executed next.- Specified by:
executeAsProcess
in interfaceProcessCommand<T>
- Parameters:
startCommand
- The command the process should start with.context
- The context to work with.- Returns:
- The next process step to execute. Null stops the process.
-
-