FieldQZSSAlmanac.java

  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. import org.hipparchus.CalculusFieldElement;
  19. import org.hipparchus.Field;

  20. import java.util.function.Function;

  21. /**
  22.  * This class holds a QZSS almanac as read from YUMA files.
  23.  *
  24.  * @param <T> type of the field elements
  25.  * @author Luc Maisonobe
  26.  * @since 13.0
  27.  *
  28.  */
  29. public class FieldQZSSAlmanac<T extends CalculusFieldElement<T>>
  30.     extends FieldAbstractAlmanac<T, QZSSAlmanac> {

  31.     /** Source of the almanac. */
  32.     private String src;

  33.     /** Health status. */
  34.     private int health;

  35.     /** Constructor from non-field instance.
  36.      * @param field    field to which elements belong
  37.      * @param original regular non-field instance
  38.      */
  39.     public FieldQZSSAlmanac(final Field<T> field, final QZSSAlmanac original) {
  40.         super(field, original);
  41.         setSource(original.getSource());
  42.         setHealth(original.getHealth());
  43.     }

  44.     /** Constructor from different field instance.
  45.      * @param <V> type of the old field elements
  46.      * @param original regular non-field instance
  47.      * @param converter for field elements
  48.      */
  49.     public <V extends CalculusFieldElement<V>> FieldQZSSAlmanac(final Function<V, T> converter,
  50.                                                                 final FieldQZSSAlmanac<V> original) {
  51.         super(converter, original);
  52.         setSource(original.getSource());
  53.         setHealth(original.getHealth());
  54.     }

  55.     /** {@inheritDoc} */
  56.     @Override
  57.     public QZSSAlmanac toNonField() {
  58.         return new QZSSAlmanac(this);
  59.     }

  60.     /** {@inheritDoc} */
  61.     @SuppressWarnings("unchecked")
  62.     @Override
  63.     public <U extends CalculusFieldElement<U>, G extends FieldGnssOrbitalElements<U, QZSSAlmanac>>
  64.         G changeField(final Function<T, U> converter) {
  65.         return (G) new FieldQZSSAlmanac<>(converter, this);
  66.     }

  67.     /**
  68.      * Setter for the Square Root of Semi-Major Axis (m^1/2).
  69.      * <p>
  70.      * In addition, this method set the value of the Semi-Major Axis.
  71.      * </p>
  72.      * @param sqrtA the Square Root of Semi-Major Axis (m^1/2)
  73.      */
  74.     public void setSqrtA(final T sqrtA) {
  75.         setSma(sqrtA.square());
  76.     }

  77.     /**
  78.      * Gets the source of this QZSS almanac.
  79.      *
  80.      * @return the source of this QZSS almanac
  81.      */
  82.     public String getSource() {
  83.         return src;
  84.     }

  85.     /**
  86.      * Sets the source of this GPS almanac.
  87.      *
  88.      * @param source the source of this GPS almanac
  89.      */
  90.     public void setSource(final String source) {
  91.         this.src = source;
  92.     }

  93.     /**
  94.      * Gets the Health status.
  95.      *
  96.      * @return the Health status
  97.      */
  98.     public int getHealth() {
  99.         return health;
  100.     }

  101.     /**
  102.      * Sets the health status.
  103.      *
  104.      * @param health the health status to set
  105.      */
  106.     public void setHealth(final int health) {
  107.         this.health = health;
  108.     }

  109. }