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

Fixed yet another set of regressions in event detectors.

parent c75c417c
Pipeline #2955 passed with stages
in 40 minutes and 59 seconds
......@@ -86,13 +86,13 @@ public class AttitudesSequence implements AttitudeProvider {
private transient TimeSpanMap<AttitudeProvider> activated;
/** Switching events list. */
private final List<Switch<?>> switches;
private final List<Switch> switches;
/** Constructor for an initially empty sequence.
*/
public AttitudesSequence() {
activated = null;
switches = new ArrayList<Switch<?>>();
switches = new ArrayList<>();
}
/** Reset the active provider.
......@@ -118,7 +118,7 @@ public class AttitudesSequence implements AttitudeProvider {
* @param propagator propagator that will handle the events
*/
public void registerSwitchEvents(final Propagator propagator) {
for (final Switch<?> s : switches) {
for (final Switch s : switches) {
propagator.addEventDetector(s);
}
}
......@@ -136,7 +136,7 @@ public class AttitudesSequence implements AttitudeProvider {
* @param <T> type of the field elements
*/
public <T extends CalculusFieldElement<T>> void registerSwitchEvents(final Field<T> field, final FieldPropagator<T> propagator) {
for (final Switch<?> sw : switches) {
for (final Switch sw : switches) {
propagator.addEventDetector(new FieldEventDetector<T>() {
/** {@inheritDoc} */
......@@ -292,8 +292,8 @@ public class AttitudesSequence implements AttitudeProvider {
}
// add the switching condition
switches.add(new Switch<T>(switchEvent, switchOnIncrease, switchOnDecrease,
past, future, transitionTime, transitionFilter, handler));
switches.add(new Switch(switchEvent, switchOnIncrease, switchOnDecrease,
past, future, transitionTime, transitionFilter, handler));
}
......@@ -305,18 +305,16 @@ public class AttitudesSequence implements AttitudeProvider {
/** {@inheritDoc} */
public <T extends CalculusFieldElement<T>> FieldAttitude<T> getAttitude(final FieldPVCoordinatesProvider<T> pvProv,
final FieldAbsoluteDate<T> date,
final Frame frame) {
final FieldAbsoluteDate<T> date,
final Frame frame) {
return activated.get(date.toAbsoluteDate()).getAttitude(pvProv, date, frame);
}
/** Switch specification.
* @param <T> class type for the generic version
*/
private class Switch<T extends EventDetector> implements EventDetector, EventHandler {
/** Switch specification. */
private class Switch implements EventDetector, EventHandler {
/** Event. */
private final T event;
private final EventDetector event;
/** Event direction triggering the switch. */
private final boolean switchOnIncrease;
......@@ -354,7 +352,7 @@ public class AttitudesSequence implements AttitudeProvider {
* should match past and future attitude laws
* @param switchHandler handler to call for notifying when switch occurs (may be null)
*/
Switch(final T event,
Switch(final EventDetector event,
final boolean switchOnIncrease, final boolean switchOnDecrease,
final AttitudeProvider past, final AttitudeProvider future,
final double transitionTime, final AngularDerivativesFilter transitionFilter,
......@@ -388,8 +386,7 @@ public class AttitudesSequence implements AttitudeProvider {
}
/** {@inheritDoc} */
public void init(final SpacecraftState s0,
final AbsoluteDate t) {
public void init(final SpacecraftState s0, final AbsoluteDate t) {
// reset the transition parameters (this will be done once for each switch,
// despite doing it only once would have sufficient; its not really a problem)
......@@ -477,7 +474,7 @@ public class AttitudesSequence implements AttitudeProvider {
@Override
public SpacecraftState resetState(final EventDetector detector, final SpacecraftState oldState) {
// delegate to underlying event
return event.getHandler().resetState(detector, oldState);
return event.getHandler().resetState(event, oldState);
}
/** Provider for transition phases.
......
......@@ -246,7 +246,7 @@ public class EventSlopeFilter<T extends EventDetector> extends AbstractDetector<
public Action eventOccurred(final SpacecraftState s, final EventDetector detector, final boolean increasing) {
@SuppressWarnings("unchecked")
final EventSlopeFilter<T> esf = (EventSlopeFilter<T>) detector;
return esf.rawDetector.getHandler().eventOccurred(s, esf, esf.filter.getTriggeredIncreasing());
return esf.rawDetector.getHandler().eventOccurred(s, esf.rawDetector, esf.filter.getTriggeredIncreasing());
}
/** {@inheritDoc} */
......@@ -254,7 +254,7 @@ public class EventSlopeFilter<T extends EventDetector> extends AbstractDetector<
public SpacecraftState resetState(final EventDetector detector, final SpacecraftState oldState) {
@SuppressWarnings("unchecked")
final EventSlopeFilter<T> esf = (EventSlopeFilter<T>) detector;
return esf.rawDetector.getHandler().resetState(esf, oldState);
return esf.rawDetector.getHandler().resetState(esf.rawDetector, oldState);
}
}
......
Supports Markdown
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