Commit a6ed3ffb authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Added detector to FieldEventHandler.init arguments list.

Fixes #849
parent 5ca905c5
......@@ -21,6 +21,9 @@
</properties>
<body>
<release version="11.1" date="TBD" description="TBD">
<action dev="luc" type="fix" issue="849">
Added detector to FieldEventHandler.init arguments list.
</action>
<action dev="luc" type="fix" issue="837">
Added getters for raw detectors in event shifter, slope filter and predicate filter.
</action>
......
......@@ -222,7 +222,9 @@ public abstract class IntervalEventTrigger<T extends AbstractDetector<T>> extend
/** {@inheritDoc} */
@Override
public void init(final FieldSpacecraftState<S> initialState, final FieldAbsoluteDate<S> target) {
public void init(final FieldSpacecraftState<S> initialState,
final FieldAbsoluteDate<S> target,
final D detector) {
forward = target.isAfterOrEqualTo(initialState);
initializeResetters(initialState, target);
}
......
......@@ -370,7 +370,9 @@ public abstract class StartStopEventsTrigger<A extends AbstractDetector<A>, O ex
/** {@inheritDoc} */
@Override
public void init(final FieldSpacecraftState<S> initialState, final FieldAbsoluteDate<S> target) {
public void init(final FieldSpacecraftState<S> initialState,
final FieldAbsoluteDate<S> target,
final D detector) {
forward = target.isAfterOrEqualTo(initialState);
initializeResetters(initialState, target);
}
......@@ -411,7 +413,9 @@ public abstract class StartStopEventsTrigger<A extends AbstractDetector<A>, O ex
/** {@inheritDoc} */
@Override
public void init(final FieldSpacecraftState<S> initialState, final FieldAbsoluteDate<S> target) {
public void init(final FieldSpacecraftState<S> initialState,
final FieldAbsoluteDate<S> target,
final D detector) {
forward = target.isAfterOrEqualTo(initialState);
initializeResetters(initialState, target);
}
......
......@@ -70,9 +70,10 @@ public abstract class FieldAbstractDetector<D extends FieldEventDetector<T>,
/** {@inheritDoc} */
public void init(final FieldSpacecraftState<T> s0,
final FieldAbsoluteDate<T> t) {
final FieldAbsoluteDate<T> t,
final D detector) {
forward = t.durationFrom(s0.getDate()).getReal() >= 0.0;
getHandler().init(s0, t);
getHandler().init(s0, t, detector);
}
/** {@inheritDoc} */
......
......@@ -49,13 +49,35 @@ public interface FieldEventHandler<KK extends FieldEventDetector<T>, T extends C
* </p>
* @param initialState initial state
* @param target target date for the propagation
*
* @deprecated as of 11.1, replaced by {@link #init(FieldSpacecraftState, FieldAbsoluteDate, FieldEventDetector)}
*/
default void init(FieldSpacecraftState<T> initialState,
FieldAbsoluteDate<T> target) {
default void init(final FieldSpacecraftState<T> initialState,
final FieldAbsoluteDate<T> target) {
// nothing by default
}
/** Initialize event handler at the start of a propagation.
* <p>
* 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.
* </p>
* <p>
* The default implementation does nothing
* </p>
* @param initialState initial state
* @param target target date for the propagation
* @param detector event detector related to the event handler
* @since 11.1
*/
default void init(FieldSpacecraftState<T> initialState,
FieldAbsoluteDate<T> target,
final KK detector) {
// TODO: remove the default implementation in 12.0
// when init(initialState, target) is removed
init(initialState, target);
}
/**
* eventOccurred method mirrors the same interface method as in {@link EventDetector}
* and its subclasses, but with an additional parameter that allows the calling
......
......@@ -101,8 +101,9 @@ public class FieldEventDetectorTest {
}
@Override
public void init(FieldSpacecraftState<T> initialState,
FieldAbsoluteDate<T> target) {
public void init(final FieldSpacecraftState<T> initialState,
final FieldAbsoluteDate<T> target,
final FieldDateDetector<T> detector) {
initCalled = true;
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment