Class EventMultipleHandler
- java.lang.Object
-
- org.orekit.propagation.events.handlers.EventMultipleHandler
-
- All Implemented Interfaces:
EventHandler
public class EventMultipleHandler extends Object implements EventHandler
Facade handlers that allows to use several handlers for one detector. Otherwise, the use of several detectors, each associated with one handler, that detect the same event can lead to non-deterministic behaviour. This handler manages several handlers. The action returned is based on a priority rule (seeeventOccurred(org.orekit.propagation.SpacecraftState, org.orekit.propagation.events.EventDetector, boolean)
) :stop
>resetState
>resetDerivatives
>resetRevents
>continue
- Since:
- 10.3
- Author:
- Lara Hué
-
-
Constructor Summary
Constructors Constructor Description EventMultipleHandler()
Constructor with list initialisation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EventMultipleHandler
addHandler(EventHandler handler)
Add one handler to the managed handlers list.EventMultipleHandler
addHandlers(EventHandler... newHandlers)
Add several handlers to the managed handlers list.Action
eventOccurred(SpacecraftState s, EventDetector detector, boolean increasing)
Handle an event.List<EventHandler>
getHandlers()
Retrieve managed handlers list.void
init(SpacecraftState initialState, AbsoluteDate target, EventDetector detector)
Initialize event handler at the start of a propagation.SpacecraftState
resetState(EventDetector detector, SpacecraftState oldState)
Reset the state prior to continue propagation.void
setHandlers(List<EventHandler> newHandlers)
Change handlers list with user input.
-
-
-
Method Detail
-
init
public void init(SpacecraftState initialState, AbsoluteDate target, EventDetector detector)
Initialize event handler at the start of a propagation.This method is called once at the start of the propagation. It may be used by the event handler to initialize some internal data if needed.
The default implementation does nothing
All handlers' init methods are successively called, the order method is the order in which handlers are added
- Specified by:
init
in interfaceEventHandler
- Parameters:
initialState
- initial statetarget
- target date for the propagationdetector
- event detector related to the event handler
-
eventOccurred
public Action eventOccurred(SpacecraftState s, EventDetector detector, boolean increasing)
Handle an event. The MultipleEventHandler class implies a different behaviour on event detections than with other handlers : Without the MultipleEventHandler, there is a total order on event occurrences. Handlers H1, H2, ... that are associated with different instances ofAbstractDetector
are successively called and Action from H1 can prevent H2 from happening if H1 returnedresetState
. With the MultipleEventHandler class, when event E occurs, all methods eventOccurred of Handlers H1, H2... from MultiEventHandler attributes are called, then Action is decided.- Specified by:
eventOccurred
in interfaceEventHandler
- Parameters:
s
- SpaceCraft state to be used in the evaluationdetector
- object with appropriate type that can be used in determining correct return stateincreasing
- 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
-
resetState
public SpacecraftState resetState(EventDetector detector, SpacecraftState oldState)
Reset the state prior to continue propagation.All handlers that return
resetState
when callingeventOccurred(org.orekit.propagation.SpacecraftState, org.orekit.propagation.events.EventDetector, boolean)
are saved in resetStateHandlers. Their methods resetState are successively called. The order for calling resetState methods is the order in which handlers are added.- Specified by:
resetState
in interfaceEventHandler
- Parameters:
detector
- object with appropriate type that can be used in determining correct return stateoldState
- old state- Returns:
- new state
-
addHandler
public EventMultipleHandler addHandler(EventHandler handler)
Add one handler to the managed handlers list.- Parameters:
handler
- handler associated with D detector- Returns:
- this object
-
addHandlers
@SafeVarargs public final EventMultipleHandler addHandlers(EventHandler... newHandlers)
Add several handlers to the managed handlers list.- Parameters:
newHandlers
- handlers associated with D detector- Returns:
- this object
-
setHandlers
public void setHandlers(List<EventHandler> newHandlers)
Change handlers list with user input.- Parameters:
newHandlers
- new handlers list associated with D detector
-
getHandlers
public List<EventHandler> getHandlers()
Retrieve managed handlers list.- Returns:
- list of handlers for event overrides
-
-