SP3OrbitType.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.Locale;

  19. /** Orbit type indicator.
  20.  * @author Thomas Neidhart
  21.  * @author Evan Ward
  22.  * @author Luc Maisonobe
  23.  */
  24. public enum SP3OrbitType {

  25.     /** fitted. */
  26.     FIT,

  27.     /** extrapolated or predicted. */
  28.     EXT,

  29.     /** broadcast. */
  30.     BCT,

  31.     /** fitted after applying a Helmert transformation. */
  32.     HLM,

  33.     /** other type, defined by SP3 file producing agency.
  34.      * @since 9.3
  35.      */
  36.     OTHER;

  37.     /** Parse a string to get the type.
  38.      * @param s string to parse
  39.      * @return the type corresponding to the string
  40.      */
  41.     public static SP3OrbitType parseType(final String s) {
  42.         final String normalizedString = s.trim().toUpperCase(Locale.US);
  43.         switch (normalizedString) {
  44.             case "EST":
  45.                 return FIT;
  46.             case "BHN":
  47.                 // ESOC navigation team uses BHN for files produced
  48.                 // by their main parameter estimation program Bahn
  49.                 return FIT;
  50.             case "PRO":
  51.                 // ESOC navigation team uses PRO for files produced
  52.                 // by their orbit propagation program Propag
  53.                 return EXT;
  54.             default:
  55.                 try {
  56.                     return valueOf(normalizedString);
  57.                 } catch (IllegalArgumentException iae) {
  58.                     return OTHER;
  59.                 }
  60.         }
  61.     }

  62. }