SP3FileType.java

  1. /* Copyright 2002-2012 Space Applications Services
  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.files.sp3;

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

  20. /** File type indicator.
  21.  * @author Thomas Neidhart
  22.  * @author Evan Ward
  23.  * @author Luc Maisonobe
  24.  * @since 12.0
  25.  */
  26. public enum SP3FileType {

  27.     /** GPS only file. */
  28.     GPS("G"),

  29.     /** Mixed file. */
  30.     MIXED("M"),

  31.     /** GLONASS only file. */
  32.     GLONASS("R"),

  33.     /** LEO only file. */
  34.     LEO("L"),

  35.     /** Galileo only file. */
  36.     GALILEO("E"),

  37.     /** SBAS only file. */
  38.     SBAS("S"),

  39.     /** NavIC only file. */
  40.     NAVIC("I"),

  41.     /** COMPASS only file. */
  42.     COMPASS("C"),

  43.     /** QZSS only file. */
  44.     QZSS("J"),

  45.     /** undefined file format. */
  46.     UNDEFINED("?");

  47.     /** Numbers map. */
  48.     private static final Map<String, SP3FileType> MAP = new HashMap<>();
  49.     static {
  50.         for (final SP3FileType type : values()) {
  51.             MAP.put(type.getKey(), type);
  52.         }
  53.     }

  54.     /** Key for the file type. */
  55.     private final String key;

  56.     /** Simple constructor.
  57.      * @param key for the file type
  58.      */
  59.     SP3FileType(final String key) {
  60.         this.key = key;
  61.     }

  62.     /** Get the key for the file type.
  63.      * @return key for the file type
  64.      */
  65.     public String getKey() {
  66.         return key;
  67.     }

  68.     /** Parse the string to get the data used.
  69.      * @param s string to parse
  70.      * @return the file type corresponding to the string
  71.      */
  72.     public static SP3FileType parse(final String s) {
  73.         final SP3FileType type = MAP.get(s.toUpperCase());
  74.         return (type == null) ? UNDEFINED : type;
  75.     }

  76. }