public class EventUsingAbstractDetector extends AbstractDetector {
private static final long serialVersionUID = 1L;
private final AbsoluteDate date;
/**
* Constructor
* @param date absolute date when event will occured.
*/
protected EventUsingAbstractDetector( final AbsoluteDate date ) {
super(AbstractDetector.DEFAULT_MAXCHECK, AbstractDetector.DEFAULT_THRESHOLD);
this.date = date;
}
@Override
public Action eventOccurred(SpacecraftState s, boolean increasing,
boolean forward) throws PatriusException {
return EventDetector.Action.STOP;
}
@Override
public double g(SpacecraftState s) throws PatriusException {
return s.getDate().durationFrom(date);
}
@Override
public boolean shouldBeRemoved() {
return false;
}
/**
* @param args
* @throws OrekitException
*/
public static void main(String[] args) throws PatriusException {
// Patrius Dataset initialization (needed for example to get the UTC time)
PatriusDataset.addResourcesFromPatriusDataset() ;
// Recovery of the UTC time scale using a "factory" (not to duplicate such unique object)
final TimeScale TUC = TimeScalesFactory.getUTC();
// Date of the orbit (given in UTC time scale)
final AbsoluteDate date = new AbsoluteDate("2010-01-01T12:00:00.000", TUC);
EventUsingAbstractDetector event = new EventUsingAbstractDetector(date);
System.out.println("Max check interval of the event: " + event.getMaxCheckInterval() + " s");
System.out.println("Threshold of the event: " + event.getThreshold() + " s");
System.out.println("Remove the event after occuring: " + event.shouldBeRemoved());
}
}