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   * Container for data contained in a GPS navigation message.
26   * @param <T> type of the field elements
27   * @author Luc Maisonobe
28   * @since 13.0
29   */
30  public class FieldGPSLegacyNavigationMessage<T extends CalculusFieldElement<T>>
31      extends FieldLegacyNavigationMessage<T, GPSLegacyNavigationMessage> {
32  
33      /** Constructor from non-field instance.
34       * @param field    field to which elements belong
35       * @param original regular non-field instance
36       */
37      public FieldGPSLegacyNavigationMessage(final Field<T> field, final GPSLegacyNavigationMessage original) {
38          super(field, original);
39      }
40  
41      /** Constructor from different field instance.
42       * @param <V> type of the old field elements
43       * @param original regular non-field instance
44       * @param converter for field elements
45       */
46      public <V extends CalculusFieldElement<V>> FieldGPSLegacyNavigationMessage(final Function<V, T> converter,
47                                                                                 final FieldGPSLegacyNavigationMessage<V> original) {
48          super(converter, original);
49      }
50  
51      /** {@inheritDoc} */
52      @Override
53      public GPSLegacyNavigationMessage toNonField() {
54          return new GPSLegacyNavigationMessage(this);
55      }
56  
57      /** {@inheritDoc} */
58      @SuppressWarnings("unchecked")
59      @Override
60      public <U extends CalculusFieldElement<U>, G extends FieldGnssOrbitalElements<U, GPSLegacyNavigationMessage>>
61          G changeField(final Function<T, U> converter) {
62          return (G) new FieldGPSLegacyNavigationMessage<>(converter, this);
63      }
64  
65  }