View Javadoc
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.ode.ODEState;
21  
22  /**
23   * Class to hold the data related to an event occurrence that is needed to decide how
24   * to modify integration.
25   * @since 3.O
26   */
27  public class EventOccurrence {
28  
29      /** User requested action. */
30      private final Action action;
31      /** New state for a reset action. */
32      private final ODEState newState;
33      /** The time to stop propagation if the action is a stop event. */
34      private final double stopTime;
35  
36      /**
37       * Create a new occurrence of an event.
38       *
39       * @param action   the user requested action.
40       * @param newState for a reset event. Should be the current state unless the
41       *                 action is {@link Action#RESET_STATE}.
42       * @param stopTime to stop propagation if the action is {@link Action#STOP}. Used
43       *                 to move the stop time to just after the root.
44       */
45      public EventOccurrence(final Action action,
46                             final ODEState newState,
47                             final double stopTime) {
48          this.action = action;
49          this.newState = newState;
50          this.stopTime = stopTime;
51      }
52  
53      /**
54       * Get the user requested action.
55       *
56       * @return the action.
57       */
58      public Action getAction() {
59          return action;
60      }
61  
62      /**
63       * Get the new state for a reset action.
64       *
65       * @return the new state.
66       */
67      public ODEState getNewState() {
68          return newState;
69      }
70  
71      /**
72       * Get the new time for a stop action.
73       *
74       * @return when to stop propagation.
75       */
76      public double getStopTime() {
77          return stopTime;
78      }
79  
80  }