Class CountingHandler

  • All Implemented Interfaces:
    EventHandler
    Direct Known Subclasses:
    CountAndContinue

    public abstract class CountingHandler
    extends Object
    implements EventHandler
    Abstract class for handlers counting event occurrences. The Action can be modified according to the count.
    Since:
    13.0
    Author:
    Romain Serra
    • Constructor Detail

      • CountingHandler

        protected CountingHandler​(int startingCount,
                                  Action action)
        Constructor.
        Parameters:
        startingCount - value to initialize count
        action - Action to initialize attribute
    • Method Detail

      • eventOccurred

        public Action eventOccurred​(SpacecraftState s,
                                    EventDetector detector,
                                    boolean increasing)
        Handle an event.
        Specified by:
        eventOccurred in interface EventHandler
        Parameters:
        s - SpaceCraft state to be used in the evaluation
        detector - object with appropriate type that can be used in determining correct return state
        increasing - with the event occurred in an "increasing" or "decreasing" slope direction
        Returns:
        the Action that the calling detector should pass back to the evaluation system
      • doesCount

        protected abstract boolean doesCount​(SpacecraftState state,
                                             EventDetector detector,
                                             boolean increasing)
        Method returning true if and only if the count needs to be incremented.
        Parameters:
        state - state at detection
        detector - detector
        increasing - flag on direction of event function
        Returns:
        flag on counting
      • getCount

        public int getCount()
        Getter for count.
        Returns:
        count
      • getAction

        protected Action getAction()
        Protected getter for the action to return.
        Returns:
        action
      • setAction

        protected void setAction​(Action action)
        Protected setter for action.
        Parameters:
        action - new action
      • reset

        public void reset()
        Reset count.
      • increment

        protected void increment()
        Increment count.