EventUsingAbstractDetector 4.1 : Différence entre versions
De Wiki
(Page créée avec « <syntaxhighlight lang="java"> public class EventUsingAbstractDetector extends AbstractDetector { private static final long serialVersionUID = 1L; private fina... ») |
|||
Ligne 30 : | Ligne 30 : | ||
} | } | ||
+ | @Override | ||
+ | public EventDetector copy() { | ||
+ | final AbsoluteDate newDate = new AbsoluteDate(date, 0.); | ||
+ | return new EventUsingEventDetector(newDate); | ||
+ | } | ||
+ | |||
/** | /** | ||
* @param args | * @param args | ||
− | * @throws | + | * @throws PatriusException |
*/ | */ | ||
public static void main(String[] args) throws PatriusException { | public static void main(String[] args) throws PatriusException { |
Version actuelle en date du 21 décembre 2018 à 10:16
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; } @Override public EventDetector copy() { final AbsoluteDate newDate = new AbsoluteDate(date, 0.); return new EventUsingEventDetector(newDate); } /** * @param args * @throws PatriusException */ 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()); } }