Class KeyValueFileParser<Key extends Enum<Key>>

  • Type Parameters:
    Key - type of the parameter keys

    public class KeyValueFileParser<Key extends Enum<Key>>
    extends Object
    Simple parser for key/value files.
    • Constructor Detail

      • KeyValueFileParser

        public KeyValueFileParser​(Class<Key> enumType)
        Simple constructor.
        Parameters:
        enumType - type of the parameters keys enumerate
    • Method Detail

      • parseInput

        public void parseInput​(String name,
                               InputStream input)
                        throws IOException
        Parse an input file.

        The input file syntax is a set of key=value lines or key[i]=value lines. Blank lines and lines starting with '#' (after whitespace trimming) are silently ignored. The equal sign may be surrounded by space characters. Keys must correspond to the Key enumerate constants, given that matching is not case sensitive and that '_' characters may appear as '.' characters in the file. This means that the lines:

           # this is the semi-major axis
           orbit.circular.a   = 7231582
         
        are perfectly right and correspond to key Key#ORBIT_CIRCULAR_A if such a constant exists in the enumerate.

        When the key[i] notation is used, all the values extracted from lines with the same key will be put in a general array that will be retrieved using one of the getXxxArray(key) methods. They will not be available with the getXxx(key) methods without the Array.

        Parameters:
        name - input file name
        input - input stream
        Throws:
        IOException - if input file cannot be read
      • containsKey

        public boolean containsKey​(Key key)
        Check if a key is contained in the map.
        Parameters:
        key - parameter key
        Returns:
        true if the key is contained in the map
      • getStringArray

        public String[] getStringArray​(Key key)
                                throws NoSuchElementException
        Get a raw string values array from a parameters map.
        Parameters:
        key - parameter key
        Returns:
        string values array corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getDouble

        public double getDouble​(Key key)
                         throws NoSuchElementException
        Get a raw double value from a parameters map.
        Parameters:
        key - parameter key
        Returns:
        double value corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getDoubleArray

        public double[] getDoubleArray​(Key key)
                                throws NoSuchElementException
        Get a raw double values array from a parameters map.
        Parameters:
        key - parameter key
        Returns:
        double values array corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getInt

        public int getInt​(Key key)
                   throws NoSuchElementException
        Get a raw int value from a parameters map.
        Parameters:
        key - parameter key
        Returns:
        int value corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getIntArray

        public int[] getIntArray​(Key key)
                          throws NoSuchElementException
        Get a raw int values array from a parameters map.
        Parameters:
        key - parameter key
        Returns:
        int values array corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getBoolean

        public boolean getBoolean​(Key key)
                           throws NoSuchElementException
        Get a raw boolean value from a parameters map.
        Parameters:
        key - parameter key
        Returns:
        boolean value corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getBooleanArray

        public boolean[] getBooleanArray​(Key key)
                                  throws NoSuchElementException
        Get a raw boolean values array from a parameters map.
        Parameters:
        key - parameter key
        Returns:
        boolean values array corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getAngle

        public double getAngle​(Key key)
                        throws NoSuchElementException
        Get an angle value from a parameters map.

        The angle is considered to be in degrees in the file, it will be returned in radians

        Parameters:
        key - parameter key
        Returns:
        angular value corresponding to the key, in radians
        Throws:
        NoSuchElementException - if key is not in the map
      • getAngleArray

        public double[] getAngleArray​(Key key)
                               throws NoSuchElementException
        Get an angle values array from a parameters map.
        Parameters:
        key - parameter key
        Returns:
        angle values array corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getDate

        public org.orekit.time.AbsoluteDate getDate​(Key key,
                                                    org.orekit.time.TimeScale scale)
                                             throws NoSuchElementException
        Get a date value from a parameters map.
        Parameters:
        key - parameter key
        scale - time scale in which the date is to be parsed
        Returns:
        date value corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getDateArray

        public org.orekit.time.AbsoluteDate[] getDateArray​(Key key,
                                                           org.orekit.time.TimeScale scale)
                                                    throws NoSuchElementException
        Get a date values array from a parameters map.
        Parameters:
        key - parameter key
        scale - time scale in which the date is to be parsed
        Returns:
        date values array corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getTime

        public org.orekit.time.TimeComponents getTime​(Key key)
                                               throws NoSuchElementException
        Get a time value from a parameters map.
        Parameters:
        key - parameter key
        Returns:
        time value corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getTimeArray

        public org.orekit.time.TimeComponents[] getTimeArray​(Key key)
                                                      throws NoSuchElementException
        Get a time values array from a parameters map.
        Parameters:
        key - parameter key
        Returns:
        time values array corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getVector

        public org.hipparchus.geometry.euclidean.threed.Vector3D getVector​(Key xKey,
                                                                           Key yKey,
                                                                           Key zKey)
                                                                    throws NoSuchElementException
        Get a vector value from a parameters map.
        Parameters:
        xKey - parameter key for abscissa
        yKey - parameter key for ordinate
        zKey - parameter key for height
        Returns:
        date value corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getVectorArray

        public org.hipparchus.geometry.euclidean.threed.Vector3D[] getVectorArray​(Key xKey,
                                                                                  Key yKey,
                                                                                  Key zKey)
                                                                           throws NoSuchElementException
        Get a vector values array from a parameters map.
        Parameters:
        xKey - parameter key for abscissa
        yKey - parameter key for ordinate
        zKey - parameter key for height
        Returns:
        date value corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getStringsList

        public List<String> getStringsList​(Key key,
                                           char separator)
                                    throws NoSuchElementException
        Get a strings list from a parameters map.
        Parameters:
        key - parameter key
        separator - elements separator
        Returns:
        strings list value corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getStringsListArray

        public List<String>[] getStringsListArray​(Key key,
                                                  char separator)
                                           throws NoSuchElementException
        Get a strings list array from a parameters map.
        Parameters:
        key - parameter key
        separator - elements separator
        Returns:
        strings list array corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getInertialFrame

        public org.orekit.frames.Frame getInertialFrame​(Key key)
                                                 throws NoSuchElementException
        Get an inertial frame from a parameters map.
        Parameters:
        key - parameter key
        Returns:
        inertial frame corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map
      • getEarthFrame

        public org.orekit.frames.Frame getEarthFrame​(Key key)
                                              throws NoSuchElementException
        Get an Earth frame from a parameters map.

        We consider Earth frames are the frames with name starting with "ITRF".

        Parameters:
        key - parameter key
        Returns:
        Earth frame corresponding to the key
        Throws:
        NoSuchElementException - if key is not in the map