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.         if ("EST".equals(normalizedString)) {
  44.             return FIT;
  45.         } else if ("BHN".equals(normalizedString)) {
  46.             // ESOC navigation team uses BHN for files produced
  47.             // by their main parameter estimation program Bahn
  48.             return FIT;
  49.         } else if ("PRO".equals(normalizedString)) {
  50.             // ESOC navigation team uses PRO for files produced
  51.             // by their orbit propagation program Propag
  52.             return EXT;
  53.         } else {
  54.             try {
  55.                 return valueOf(normalizedString);
  56.             } catch (IllegalArgumentException iae) {
  57.                 return OTHER;
  58.             }
  59.         }
  60.     }

  61. }