1   /* Copyright 2002-2025 CS GROUP
2    * Licensed to CS GROUP (CS) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * CS 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    *   http://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.orekit.forces.maneuvers.trigger;
19  
20  import org.hipparchus.CalculusFieldElement;
21  import org.orekit.forces.maneuvers.Maneuver;
22  import org.orekit.propagation.FieldSpacecraftState;
23  import org.orekit.propagation.SpacecraftState;
24  import org.orekit.propagation.events.EventDetectorsProvider;
25  import org.orekit.time.AbsoluteDate;
26  import org.orekit.time.FieldAbsoluteDate;
27  import org.orekit.utils.ParameterDriversProvider;
28  
29  /** Generic interface for the maneuver triggers used in a {@link Maneuver}.
30   * @author Maxime Journot
31   * @since 10.2
32   */
33  public interface ManeuverTriggers extends ParameterDriversProvider, EventDetectorsProvider {
34  
35      /** Initialization method called at propagation start.
36       * <p>
37       * The default implementation does nothing.
38       * </p>
39       * @param initialState initial spacecraft state (at the start of propagation).
40       * @param target date of propagation. Not equal to {@code initialState.getDate()}.
41       */
42      default void init(SpacecraftState initialState, AbsoluteDate target) {
43          // nothing by default
44      }
45  
46      /** Initialization method called at propagation start.
47       * <p>
48       * The default implementation does nothing.
49       * </p>
50       * @param initialState initial spacecraft state (at the start of propagation).
51       * @param target date of propagation. Not equal to {@code initialState.getDate()}.
52       * @param <T> type of the elements
53       * @since 11.1
54       */
55      default <T extends CalculusFieldElement<T>> void init(FieldSpacecraftState<T> initialState, FieldAbsoluteDate<T> target) {
56          init(initialState.toSpacecraftState(), target.toAbsoluteDate());
57      }
58  
59      /** Find out if the maneuver is firing or not.
60       * @param date current date
61       * @param parameters maneuver triggers parameters
62       * @return true if the maneuver is firing, false otherwise
63       */
64      boolean isFiring(AbsoluteDate date, double[] parameters);
65  
66      /** Find out if the maneuver is firing or not.
67       * @param date current date
68       * @param parameters maneuver triggers parameters
69       * @param <T> type of the field elements
70       * @return true if the maneuver is firing, false otherwise
71       */
72      <T extends CalculusFieldElement<T>> boolean isFiring(FieldAbsoluteDate<T> date, T[] parameters);
73  
74      /** Get the maneuver name.
75       * @return the maneuver name
76       */
77      default String getName() {
78          return "";
79      }
80  }