SatelliteAntennaCode.java

  1. /* Copyright 2002-2018 CS Systèmes d'Information
  2.  * Licensed to CS Systèmes d'Information (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.antenna;

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

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

  22. /**
  23.  * Enumerate for satellite antenna codes.
  24.  *
  25.  * @author Luc Maisonobe
  26.  * @since 9.2
  27.  */
  28. public enum SatelliteAntennaCode {

  29.     /** BeiDou-2 GEO. */
  30.     BEIDOU_2G("BEIDOU-2G"),

  31.     /** BeiDou-2 IGSO. */
  32.     BEIDOU_2I("BEIDOU-2I"),

  33.     /** BeiDou-2 MEO. */
  34.     BEIDOU_2M("BEIDOU-2M"),

  35.     /** BeiDou-3 IGSO. */
  36.     BEIDOU_3I("BEIDOU-3I"),

  37.     /** GPS Block I     : SVN 01-11. */
  38.     BLOCK_I("BLOCK I"),

  39.     /** GPS Block II    : SVN 13-21. */
  40.     BLOCK_II("BLOCK II"),

  41.     /** GPS Block IIA   : SVN 22-40. */
  42.     BLOCK_IIA("BLOCK IIA"),

  43.     /** GPS Block IIR   : SVN 41, 43-46, 51, 54, 56. */
  44.     BLOCK_IIR_A("BLOCK IIR-A"),

  45.     /** GPS Block IIR   : SVN 47, 59-61. */
  46.     BLOCK_IIR_B("BLOCK IIR-B"),

  47.     /** GPS Block IIR-M : SVN 48-50, 52-53, 55, 57-58. */
  48.     BLOCK_IIR_M("BLOCK IIR-M"),

  49.     /** GPS Block IIF   : SVN 62-73. */
  50.     BLOCK_IIF("BLOCK IIF"),

  51.     /** GPS Block IIIA  : SVN 74-81. */
  52.     BLOCK_IIIA("BLOCK IIIA"),

  53.     /** Galileo In-Orbit Validation Element A (GIOVE-A). */
  54.     GALILEO_0A("GALILEO-0A"),

  55.     /** Galileo In-Orbit Validation Element B (GIOVE-B). */
  56.     GALILEO_0B("GALILEO-0B"),

  57.     /** Galileo IOV     : GSAT 0101-0104. */
  58.     GALILEO_1("GALILEO-1"),

  59.     /** Galileo FOC     : GSAT 0201-0222. */
  60.     GALILEO_2("GALILEO-2"),

  61.     /** GLONASS         : GLONASS no. 201-249, 750-798. */
  62.     GLONASS("GLONASS"),

  63.     /** GLONASS-M       : GLONASS no. 701-749, IGS SVN R850-R861 (GLO no. + 100). */
  64.     GLONASS_M("GLONASS-M"),

  65.     /** GLONASS-K1      : IGS SVN R801-R802 (GLO no. + 100). */
  66.     GLONASS_K1("GLONASS-K1"),

  67.     /** GLONASS-K2. */
  68.     GLONASS_K2("GLONASS-K2"),

  69.     /** IRNSS-1 GEO. */
  70.     IRNSS_1GEO("IRNSS-1GEO"),

  71.     /** IRNSS-1 IGSO. */
  72.     IRNSS_1IGSO("IRNSS-1IGSO"),

  73.     /** QZSS Block I (Michibiki-1). */
  74.     QZSS("QZSS"),

  75.     /** QZSS Block II IGSO (Michibiki-2,4). */
  76.     QZSS_2I("QZSS-2I"),

  77.     /** QZSS Block II GEO (Michibiki-3). */
  78.     QZSS_2G("QZSS-2G");

  79.     /** Parsing map. */
  80.     private static final Map<String, SatelliteAntennaCode> NAMES_MAP = new HashMap<>();
  81.     static {
  82.         for (final SatelliteAntennaCode satelliteAntennaCode : values()) {
  83.             NAMES_MAP.put(satelliteAntennaCode.getName(), satelliteAntennaCode);
  84.         }
  85.     }

  86.     /** IGS name for the antenna code. */
  87.     private final String name;

  88.     /** Simple constructor.
  89.      * @param name IGS name for the antenna code
  90.      */
  91.     SatelliteAntennaCode(final String name) {
  92.         this.name = name;
  93.     }

  94.     /** Get the IGS name for the antenna code.
  95.      * @return IGS name for the antenna code
  96.      */
  97.     public String getName() {
  98.         return name;
  99.     }

  100.     /** Parse a string to get the satellite antenna code.
  101.      * @param s string to parse (must be a strict IGS name)
  102.      * @return the satellite antenna code
  103.      * @exception OrekitIllegalArgumentException if the string does not correspond to a satellite antenna code
  104.      */
  105.     public static SatelliteAntennaCode parseSatelliteAntennaCode(final String s)
  106.         throws OrekitIllegalArgumentException {
  107.         final SatelliteAntennaCode satelliteAntennaCode = NAMES_MAP.get(s);
  108.         if (satelliteAntennaCode == null) {
  109.             throw new OrekitIllegalArgumentException(OrekitMessages.UNKNOWN_SATELLITE_ANTENNA_CODE, s);
  110.         }
  111.         return satelliteAntennaCode;
  112.     }

  113. }