fr.cnes.sirius.patrius.events.multi
Class MultiEventsLogger

java.lang.Object
  extended by fr.cnes.sirius.patrius.events.multi.MultiEventsLogger

public class MultiEventsLogger
extends Object

This class is copied from EventsLogger and adapted to multi propagation.

This class logs multi events detectors events.

As multi events detectors are triggered during orbit propagation, an event specific eventOccurred method is called. This class can be used to add a global logging feature registering all events with their corresponding states in a chronological sequence (or reverse-chronological if propagation occurs backward).

This class works by wrapping user-provided multi events detectors before they are registered to the propagator. The wrapper monitor the calls to eventOccurred and store the corresponding events as MultiEventsLogger.MultiLoggedEvent instances. After propagation is complete, the user can retrieve all the events that have occurred at once by calling method getLoggedEvents().

Since:
3.0
Version:
$Id: MultiEventsLogger.java 17586 2017-05-10 13:29:16Z bignon $
Author:
maggioranic
Concurrency :
not thread-safe

Nested Class Summary
static class MultiEventsLogger.MultiLoggedEvent
          Class for logged events entries.
 
Constructor Summary
MultiEventsLogger()
          Simple constructor.
 
Method Summary
 void clearLoggedEvents()
          Clear the logged events.
 List<MultiEventsLogger.MultiLoggedEvent> getLoggedEvents()
          Get an immutable copy of the logged events.
 MultiEventDetector monitorDetector(MultiEventDetector monitoredDetector)
          Monitor a multi event detector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiEventsLogger

public MultiEventsLogger()
Simple constructor.

Build an empty logger for events detectors.

Method Detail

monitorDetector

public MultiEventDetector monitorDetector(MultiEventDetector monitoredDetector)
Monitor a multi event detector.

In order to monitor a multi event detector, it must be wrapped thanks to this method as follows:

 MultiPropagator propagator = new XyzPropagator(...);
 MultiEventsLogger logger = new MultiEventsLogger();
 MultiEventDetector detector = new UvwDetector(...);
 propagator.addEventDetector(logger.monitorDetector(detector));
 

Note that the event detector returned by the getEventDetector method in LoggedEvent instances returned by getLoggedEvents() are the monitoredDetector instances themselves, not the wrapping detector returned by this method.

Parameters:
monitoredDetector - multi event detector to monitor
Returns:
the wrapping detector to add to the propagator

clearLoggedEvents

public void clearLoggedEvents()
Clear the logged events.


getLoggedEvents

public List<MultiEventsLogger.MultiLoggedEvent> getLoggedEvents()
Get an immutable copy of the logged events.

The copy is independent of the logger. It is preserved event if the clearLoggedEvents method is called and the logger reused in another propagation.

Returns:
an immutable copy of the logged events


Copyright © 2017 CNES. All Rights Reserved.