NavigationSystem.java

  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. package org.orekit.gnss.metric.ntrip;

  18. import java.util.HashMap;
  19. import java.util.Map;

  20. import org.orekit.errors.OrekitException;
  21. import org.orekit.errors.OrekitMessages;

  22. /** Enumerate for navigation system in {@link DataStreamRecord}.
  23.  * @author Luc Maisonobe
  24.  * @since 11.0
  25.  */
  26. public enum NavigationSystem {

  27.     /** GPS. */
  28.     GPS("GPS"),

  29.     /** Glonass. */
  30.     GLO("GLO", "Glonass"),

  31.     /** Galileo. */
  32.     GAL("GAL", "Galileo"),

  33.     /** Beidou. */
  34.     BDS("BDS", "Beidou"),

  35.     /** QZNSS. */
  36.     QZS("QZS", "QZNSS"),

  37.     /** SBAS. */
  38.     SBAS("SBAS"),

  39.     /** NavIC. */
  40.     IRS("IRS", "IRNSS"),

  41.     /** No navigation system for this stream. */
  42.     EMPTY("");

  43.     /** Keywords map. */
  44.     private static final Map<String, NavigationSystem> KEYWORDS_MAP = new HashMap<>();
  45.     static {
  46.         for (final NavigationSystem type : values()) {
  47.             KEYWORDS_MAP.put(type.getKeyword(), type);
  48.         }
  49.     }

  50.     /** Keyword. */
  51.     private final String keyword;

  52.     /** Name. */
  53.     private final String name;

  54.     /** Simple constructor.
  55.      * @param keyword keyword in the sourcetable records
  56.      */
  57.     NavigationSystem(final String keyword) {
  58.         this(keyword, keyword);
  59.     }

  60.     /** Simple constructor.
  61.      * @param keyword keyword in the sourcetable records
  62.      * @param name readable name
  63.      */
  64.     NavigationSystem(final String keyword, final String name) {
  65.         this.keyword = keyword;
  66.         this.name    = name;
  67.     }

  68.     /** Get keyword.
  69.      * @return keyword
  70.      */
  71.     private String getKeyword() {
  72.         return keyword;
  73.     }

  74.     /** {@inheritDoc} */
  75.     @Override
  76.     public String toString() {
  77.         return name;
  78.     }

  79.     /** Get the navigation system corresponding to a keyword.
  80.      * @param keyword navigation system keyword
  81.      * @return the navigation system corresponding to the keyword
  82.      */
  83.     public static NavigationSystem getNavigationSystem(final String keyword) {
  84.         final NavigationSystem system = KEYWORDS_MAP.get(keyword);
  85.         if (system == null) {
  86.             throw new OrekitException(OrekitMessages.UNKNOWN_NAVIGATION_SYSTEM, keyword);
  87.         }
  88.         return system;
  89.     }

  90. }