Class KeyValueFileParser<Key extends Enum<Key>>
- java.lang.Object
-
- org.orekit.tutorials.KeyValueFileParser<Key>
-
-
Constructor Summary
Constructors Constructor Description KeyValueFileParser(Class<Key> enumType)
Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(Key key)
Check if a key is contained in the map.double
getAngle(Key key)
Get an angle value from a parameters map.double[]
getAngleArray(Key key)
Get an angle values array from a parameters map.boolean
getBoolean(Key key)
Get a raw boolean value from a parameters map.boolean[]
getBooleanArray(Key key)
Get a raw boolean values array from a parameters map.org.orekit.time.AbsoluteDate
getDate(Key key, org.orekit.time.TimeScale scale)
Get a date value from a parameters map.org.orekit.time.AbsoluteDate[]
getDateArray(Key key, org.orekit.time.TimeScale scale)
Get a date values array from a parameters map.double
getDouble(Key key)
Get a raw double value from a parameters map.double[]
getDoubleArray(Key key)
Get a raw double values array from a parameters map.org.orekit.frames.Frame
getEarthFrame(Key key)
Get an Earth frame from a parameters map.org.orekit.frames.Frame
getInertialFrame(Key key)
Get an inertial frame from a parameters map.int
getInt(Key key)
Get a raw int value from a parameters map.int[]
getIntArray(Key key)
Get a raw int values array from a parameters map.String
getString(Key key)
Get a raw string value from a parameters map.String[]
getStringArray(Key key)
Get a raw string values array from a parameters map.List<String>
getStringsList(Key key, char separator)
Get a strings list from a parameters map.List<String>[]
getStringsListArray(Key key, char separator)
Get a strings list array from a parameters map.org.orekit.time.TimeComponents
getTime(Key key)
Get a time value from a parameters map.org.orekit.time.TimeComponents[]
getTimeArray(Key key)
Get a time values array from a parameters map.org.hipparchus.geometry.euclidean.threed.Vector3D
getVector(Key xKey, Key yKey, Key zKey)
Get a vector value from a parameters map.org.hipparchus.geometry.euclidean.threed.Vector3D[]
getVectorArray(Key xKey, Key yKey, Key zKey)
Get a vector values array from a parameters map.void
parseInput(String name, InputStream input)
Parse an input file.
-
-
-
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 orkey[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 theKey
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 keyKey#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 thegetXxx(key)
methods without theArray
.- Parameters:
name
- input file nameinput
- 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
-
getString
public String getString(Key key) throws NoSuchElementException
Get a raw string value from a parameters map.- Parameters:
key
- parameter key- Returns:
- string value corresponding to the key
- Throws:
NoSuchElementException
- if key is not 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 keyscale
- 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 keyscale
- 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 abscissayKey
- parameter key for ordinatezKey
- 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 abscissayKey
- parameter key for ordinatezKey
- 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 keyseparator
- 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 keyseparator
- 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
-
-