Class Procedure
Steps.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplyStepExecutor(@Nullable Object obj) Applies some kind of input to theStepExecutorfor the current step.Getter for the steps in this procedure.@Nullable StepGets the message for the current step, with all the variables filled in.Gets the name of the current step.getMessage(@Nullable Step step) Gets the message for a specific step, with all the variables filled in.getStepByName(String name) Retrieves a step by itsStep.getName().getStepName(@Nullable Step step) Gets the name of a specific step.intGets the number of steps that have been completed.voidAdvances to the next step.voidHandles the completion of the current step.booleanChecks if another step exists after the current one.booleanWhether the current step should continue to the next step if execution was successful.voidinsertStep(String name) Inserts an existing, named step at the current position.voidinsertStep(Step step) Inserts a step before the current step and goes to the previous step.@Nullable StepRuns the step preparation for the current step if applicable.booleanskipToStep(Step goalStep) toString()booleanWhether the current step requires waiting for user input.
-
Constructor Details
-
Procedure
-
-
Method Details
-
getAllSteps
Getter for the steps in this procedure.- Returns:
- A list containing all steps in this procedure including any that may have been completed already.
-
getStepByName
Retrieves a step by itsStep.getName().- Parameters:
name- The name of the step to retrieve.- Returns:
- The step, if it exists in this procedure.
-
insertStep
Inserts a step before the current step and goes to the previous step.After this call,
getCurrentStep()will return the inserted step andgoToNextStep()will proceed to the previous 'current' step.- Parameters:
step- The step to insert.
-
insertStep
Inserts an existing, named step at the current position.See
getStepByName(String)andinsertStep(Step).- Parameters:
name- The name of the step to insert.- Throws:
NoSuchElementException- If no step can be found by that name.
-
hasNextStep
public boolean hasNextStep()Checks if another step exists after the current one.- Returns:
- True if the current step is followed by another one. When false, the current step is the final step.
-
goToNextStep
public void goToNextStep()Advances to the next step. -
skipToStep
Skips to a specificStepin thisProcedure.If the step could not be found, the procedure will skip to the last step.
- Parameters:
goalStep- TheStepto jump to.- Returns:
- True if the jump was successful, otherwise false.
-
applyStepExecutor
public CompletableFuture<Boolean> applyStepExecutor(@Nullable @Nullable Object obj) throws IllegalArgumentException Applies some kind of input to theStepExecutorfor the current step.- Parameters:
obj- The input to apply.- Returns:
- True if the application was successful.
- Throws:
IllegalArgumentException- If the input object is not of the expected type.
-
getCurrentStepMessage
Gets the message for the current step, with all the variables filled in.- Returns:
- The message for the current step.
-
getMessage
Gets the message for a specific step, with all the variables filled in.If the step is null, a generic error message will be returned.
A shortcut for getting the message for the current step is
getCurrentStepMessage().- Parameters:
step- The step to get the message for.- Returns:
- The message for the step.
-
getCurrentStepName
Gets the name of the current step.This is a shortcut for
getStepName(Step)with the current step.- Returns:
- The name of the current step.
-
getStepName
Gets the name of a specific step.If the step is null, a generic error message will be returned.
A shortcut for getting the name of the current step is
getCurrentStepName().- Parameters:
step- The step to get the name of.- Returns:
- The name of the step.
-
waitForUserInput
public boolean waitForUserInput()Whether the current step requires waiting for user input.- Returns:
- True if the current step should wait for user input.
-
handleStepCompletion
public void handleStepCompletion()Handles the completion of the current step.This will automatically move to the next step if
implicitNextStep()returns true.If the current step is null, this will do nothing.
This is a shortcut for
implicitNextStep()andgoToNextStep()(if the former returns true). -
implicitNextStep
public boolean implicitNextStep()Whether the current step should continue to the next step if execution was successful.If no next step (see
hasNextStep()) is available, this will always return false.If this is false, the procedure should not be moved to the next step automatically, as this is supposed to be handled explicitly by the step executor itself.
- Returns:
- True if the current step should continue to the next step if execution was successful.
-
runCurrentStepPreparation
Runs the step preparation for the current step if applicable. SeeStep.getStepPreparation().- Returns:
- The current step if it exists, otherwise null.
-
getCurrentStep
-
getStepsCompleted
public int getStepsCompleted()Gets the number of steps that have been completed.- Returns:
- The number of steps that have been completed.
-
toString
-