1   /* Copyright 2022-2025 Luc Maisonobe
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.propagation.analytical.gnss.data;
18  
19  import org.hipparchus.CalculusFieldElement;
20  import org.hipparchus.Field;
21  
22  import java.util.function.Function;
23  
24  /**
25   * Class for NavIC almanac.
26   *
27   * @see "Indian Regional Navigation Satellite System, Signal In Space ICD
28   *       for standard positioning service, version 1.1 - Table 28"
29   *
30   * @param <T> type of the field elements
31   * @author Luc Maisonobe
32   * @since 13.0
33   *
34   */
35  public class FieldNavICAlmanac<T extends CalculusFieldElement<T>>
36      extends FieldAbstractAlmanac<T, NavICAlmanac> {
37  
38      /** Constructor from non-field instance.
39       * @param field    field to which elements belong
40       * @param original regular non-field instance
41       */
42      public FieldNavICAlmanac(final Field<T> field, final NavICAlmanac original) {
43          super(field, original);
44      }
45  
46      /** Constructor from different field instance.
47       * @param <V> type of the old field elements
48       * @param original regular non-field instance
49       * @param converter for field elements
50       */
51      public <V extends CalculusFieldElement<V>> FieldNavICAlmanac(final Function<V, T> converter,
52                                                                   final FieldNavICAlmanac<V> original) {
53          super(converter, original);
54      }
55  
56      /** {@inheritDoc} */
57      @Override
58      public NavICAlmanac toNonField() {
59          return new NavICAlmanac(this);
60      }
61  
62      /** {@inheritDoc} */
63      @SuppressWarnings("unchecked")
64      @Override
65      public <U extends CalculusFieldElement<U>, G extends FieldGnssOrbitalElements<U, NavICAlmanac>>
66          G changeField(final Function<T, U> converter) {
67          return (G) new FieldNavICAlmanac<>(converter, this);
68      }
69  
70      /**
71       * Setter for the Square Root of Semi-Major Axis (m^1/2).
72       * <p>
73       * In addition, this method set the value of the Semi-Major Axis.
74       * </p>
75       * @param sqrtA the Square Root of Semi-Major Axis (m^1/2)
76       */
77      public void setSqrtA(final T sqrtA) {
78          setSma(sqrtA.square());
79      }
80  
81  }