1 /*
2 * Licensed to the Hipparchus project under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The Hipparchus project licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 package org.hipparchus.ode.events;
19
20 import org.hipparchus.CalculusFieldElement;
21 import org.hipparchus.ode.FieldODEState;
22
23 /**
24 * Class to hold the data related to an event occurrence that is needed to decide how
25 * to modify integration.
26 * @param <T> the type of the field elements
27 */
28 public class FieldEventOccurrence<T extends CalculusFieldElement<T>> {
29
30 /** User requested action. */
31 private final Action action;
32 /** New state for a reset action. */
33 private final FieldODEState<T> newState;
34 /** The time to stop propagation if the action is a stop event. */
35 private final T stopTime;
36
37 /**
38 * Create a new occurrence of an event.
39 *
40 * @param action the user requested action.
41 * @param newState for a reset event. Should be the current state unless the
42 * action is {@link Action#RESET_STATE}.
43 * @param stopTime to stop propagation if the action is {@link Action#STOP}. Used
44 * to move the stop time to just after the root.
45 */
46 public FieldEventOccurrence(final Action action,
47 final FieldODEState<T> newState,
48 final T stopTime) {
49 this.action = action;
50 this.newState = newState;
51 this.stopTime = stopTime;
52 }
53
54 /**
55 * Get the user requested action.
56 *
57 * @return the action.
58 */
59 public Action getAction() {
60 return action;
61 }
62
63 /**
64 * Get the new state for a reset action.
65 *
66 * @return the new state.
67 */
68 public FieldODEState<T> getNewState() {
69 return newState;
70 }
71
72 /**
73 * Get the new time for a stop action.
74 *
75 * @return when to stop propagation.
76 */
77 public T getStopTime() {
78 return stopTime;
79 }
80
81 }