Class ConditionalActionProcessor


  • public class ConditionalActionProcessor
    extends java.lang.Object
    Processes the ConditionalActions to check if their testCondition() is true, if so the action is executed. All actions are checked until no action's testCondition() is true To prevent conditional cycling the number of rescans is limited to DEFAULT_MAX_SCANS, which can be changed by the user or turned off via setMaxScanFlag()
    • Constructor Detail

      • ConditionalActionProcessor

        public ConditionalActionProcessor()
    • Method Detail

      • register

        public void register​(ConditionalAction action)
        Registers the action with the default priority
        Parameters:
        action - the action
      • register

        public void register​(ConditionalAction action,
                             int priority)
        Registers the action with the given priority
        Parameters:
        action - the action
        priority - the priority
      • changePriority

        public void changePriority​(ConditionalAction action,
                                   int priority)
        Changes the priority of a previously registered action
        Parameters:
        action - the action
        priority - the priority
      • unregister

        public void unregister​(ConditionalAction action)
        Unregisters the action from the simulation
        Parameters:
        action - the action
      • unregisterAllActions

        public final void unregisterAllActions()
        Unregisters all actions that were previously registered.
      • executeConditionalActions

        protected boolean executeConditionalActions()
        Returns true at least one ConditionalAction was executed false means all actions tested false
        Returns:
        true if at least one
      • getMaxScans

        public final int getMaxScans()
        Returns the maximum number of scans during the c phase
        Returns:
        the max
      • setMaxScans

        public final void setMaxScans​(int max)
        Sets the maximum number of scans
        Parameters:
        max - , must be > 0
      • performCPhase

        protected void performCPhase()
      • getMaxScanFlag

        public final boolean getMaxScanFlag()
        Returns the maximum scan flag
        Returns:
        true means scans are monitored
      • setMaxScanFlag

        public final void setMaxScanFlag​(boolean flag)
        Sets the maximum scan checking flag. If true the maximum number of scans is monitored during the c phase
        Parameters:
        flag - true means monitor scans