Class ParallelActionGroup

java.lang.Object
neqsim.process.logic.action.ParallelActionGroup
All Implemented Interfaces:
LogicAction

public class ParallelActionGroup extends Object implements 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 Details

    • description

      private final String description
    • actions

      private final List<LogicAction> actions
    • executed

      private boolean executed
  • Constructor Details

    • ParallelActionGroup

      public ParallelActionGroup(String description)
      Creates a parallel action group.
      Parameters:
      description - description of this parallel group
  • Method Details

    • addAction

      public void addAction(LogicAction action)
      Adds an action to execute in parallel.
      Parameters:
      action - action to add
    • execute

      public void execute()
      Description copied from interface: LogicAction
      Executes the action.

      This method performs the actual operation on the target equipment.

      Specified by:
      execute in interface LogicAction
    • isComplete

      public boolean isComplete()
      Description copied from interface: LogicAction
      Checks 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:
      isComplete in interface LogicAction
      Returns:
      true if action is complete
    • getDescription

      public String getDescription()
      Description copied from interface: LogicAction
      Gets a human-readable description of the action.
      Specified by:
      getDescription in interface LogicAction
      Returns:
      action description
    • getTargetName

      public String getTargetName()
      Description copied from interface: LogicAction
      Gets the name of the target equipment.
      Specified by:
      getTargetName in interface LogicAction
      Returns:
      equipment name
    • getActions

      public List<LogicAction> 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

      public String toString()
      Overrides:
      toString in class Object