Class RecordAndContinue<T extends EventDetector>

  • Type Parameters:
    T - the type of EventDetector that this event handler will handle events for.
    All Implemented Interfaces:
    EventHandler<T>

    public class RecordAndContinue<T extends EventDetector>
    extends Object
    implements EventHandler<T>
    Handler that will record every time an event occurs and always return EventHandler.Action.CONTINUE.

    As this handler stores all observed events it may consume large amounts of memory depending on the duration of propagation and the frequency of events.

    Author:
    Evan Ward
    • Constructor Detail

      • RecordAndContinue

        public RecordAndContinue()
        Create a new handler using an ArrayList to store events.
      • RecordAndContinue

        public RecordAndContinue​(List<RecordAndContinue.Event<T>> events)
        Create a handler using the given collection to store events.
        Parameters:
        events - collection.
    • Method Detail

      • getEvents

        public List<RecordAndContinue.Event<T>> getEvents()
        Get the events passed to this handler.

        Note the returned list of events is in the order the events were passed to this handler by calling eventOccurred(SpacecraftState, EventDetector, boolean). This may or may not be chronological order.

        Also not that this method returns a view of the internal collection used to store events and calling any of this handler's methods may modify both the underlying collection and the returned view. If a snapshot of the events up to a certain point is needed create a copy of the returned collection.

        Returns:
        the events observed by the handler in the order they were observed.
      • clear

        public void clear()
        Clear all stored events.
      • eventOccurred

        public EventHandler.Action eventOccurred​(SpacecraftState s,
                                                 T detector,
                                                 boolean increasing)
        Description copied from interface: EventHandler
        eventOccurred method mirrors the same interface method as in EventDetector and its subclasses, but with an additional parameter that allows the calling method to pass in an object from the detector which would have potential additional data to allow the implementing class to determine the correct return state.
        Specified by:
        eventOccurred in interface EventHandler<T extends EventDetector>
        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