Class ParallelActionGroup
java.lang.Object
neqsim.process.logic.action.ParallelActionGroup
- All Implemented Interfaces:
LogicAction
Executes multiple actions in parallel and tracks completion.
Parallel action groups allow simultaneous execution of multiple operations, which is useful for:
- Opening multiple valves at once
- Starting multiple pumps simultaneously
- Coordinated equipment activation
- Reducing total sequence time
The parallel group is considered complete only when ALL actions have completed.
Example usage:
// Create parallel group to open multiple valves at once
ParallelActionGroup parallelOpen = new ParallelActionGroup("Open All Valves");
parallelOpen.addAction(new OpenValveAction(valve1));
parallelOpen.addAction(new OpenValveAction(valve2));
parallelOpen.addAction(new OpenValveAction(valve3));
// Add to sequence
startupLogic.addAction(parallelOpen, 0.0);
// Execute - all valves open simultaneously
parallelOpen.execute();
if (parallelOpen.isComplete()) {
// All valves fully open
}
- Version:
- 1.0
- Author:
- ESOL
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<LogicAction> private final Stringprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAction(LogicAction action) Adds an action to execute in parallel.voidexecute()Executes the action.Gets all actions in this parallel group.intGets the number of completed actions.doubleGets the completion percentage.Gets a human-readable description of the action.Gets the name of the target equipment.intGets the total number of actions.booleanChecks if the action has completed.toString()
-
Field Details
-
description
-
actions
-
executed
private boolean executed
-
-
Constructor Details
-
ParallelActionGroup
Creates a parallel action group.- Parameters:
description- description of this parallel group
-
-
Method Details
-
addAction
Adds an action to execute in parallel.- Parameters:
action- action to add
-
execute
public void execute()Description copied from interface:LogicActionExecutes the action.This method performs the actual operation on the target equipment.
- Specified by:
executein interfaceLogicAction
-
isComplete
public boolean isComplete()Description copied from interface:LogicActionChecks if the action has completed.Some actions are instantaneous (return true immediately), while others may take time to complete (e.g., valve stroke).
- Specified by:
isCompletein interfaceLogicAction- Returns:
- true if action is complete
-
getDescription
Description copied from interface:LogicActionGets a human-readable description of the action.- Specified by:
getDescriptionin interfaceLogicAction- Returns:
- action description
-
getTargetName
Description copied from interface:LogicActionGets the name of the target equipment.- Specified by:
getTargetNamein interfaceLogicAction- Returns:
- equipment name
-
getActions
Gets all actions in this parallel group.- Returns:
- list of actions
-
getCompletedCount
public int getCompletedCount()Gets the number of completed actions.- Returns:
- completed count
-
getTotalCount
public int getTotalCount()Gets the total number of actions.- Returns:
- total action count
-
getCompletionPercentage
public double getCompletionPercentage()Gets the completion percentage.- Returns:
- percentage 0-100
-
toString
-