1   /* Copyright 2013-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  package org.orekit.rugged.utils;
18  
19  import java.util.List;
20  
21  import org.hipparchus.Field;
22  import org.hipparchus.analysis.differentiation.Derivative;
23  import org.orekit.utils.ParameterDriver;
24  
25  /** Generator for {@link Derivative} instances from {@link ParameterDriver}.
26   * <p>
27   * Note that this interface is for Rugged library internal use only.
28   * </p>
29   * @author Luc Maisonobe
30   * @since 2.0
31   */
32  public interface DerivativeGenerator<T extends Derivative<T>> {
33  
34      /** Get the parameters selected for estimation.
35       * @return parameters selected for estimation
36       */
37      List<ParameterDriver> getSelected();
38  
39      /** Generate a constant {@link Derivative}.
40       * @param value value of the constant
41       * @return constant {@link Derivative}
42       */
43      T constant(double value);
44  
45      /** Generate a {@link Derivative} representing the
46       * parameter driver either as a canonical variable or a constant.
47       * <p>
48       * The instance created is a variable only if the parameter
49       * has been selected for estimation, otherwise it is a constant.
50       * </p>
51       * @param driver driver for the variable
52       * @return variable {@link Derivative}
53       */
54      T variable(ParameterDriver driver);
55  
56      /** Get the {@link Field} to which the generated derivatives belongs.
57       * @return {@link Field} to which the generated derivatives belongs
58       * @since 2.2
59       */
60      default Field<T> getField() {
61          return constant(0).getField();
62      }
63  
64  }