Class ParseToken
- java.lang.Object
-
- org.orekit.files.ccsds.utils.lexical.ParseToken
-
public class ParseToken extends Object
Token occurring during CCSDS file parsing.Parse tokens correspond to:
- bloc or entry start
- entry content
- bloc or entry end
- raw lines
- Since:
- 11.0
- Author:
- Luc Maisonobe
- See Also:
MessageParser
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ParseToken.BooleanConsumer
Interface representing instance methods that consume boolean values.static interface
ParseToken.CenterConsumer
Interface representing instance methods that consume center values.static interface
ParseToken.CenterListConsumer
Interface representing instance methods that consume center lists.static interface
ParseToken.CharConsumer
Interface representing instance methods that consume character values.static interface
ParseToken.DateConsumer
Interface representing instance methods that consume date values.static interface
ParseToken.DoubleArrayConsumer
Interface representing instance methods that consume double array.static interface
ParseToken.DoubleConsumer
Interface representing instance methods that consume double values.static interface
ParseToken.DoublyIndexedDoubleConsumer
Interface representing instance methods that consume doubly-indexed double values.static interface
ParseToken.EnumConsumer<T extends Enum<T>>
Interface representing instance methods that consume enum values.static interface
ParseToken.EnumListConsumer<T extends Enum<T>>
Interface representing instance methods that consume lists of enum values.static interface
ParseToken.FrameConsumer
Interface representing instance methods that consume frame values.static interface
ParseToken.IndexedDoubleArrayConsumer
Interface representing instance methods that consume indexed double array values.static interface
ParseToken.IndexedDoubleConsumer
Interface representing instance methods that consume indexed double values.static interface
ParseToken.IndexedIntConsumer
Interface representing instance methods that consume indexed integer values.static interface
ParseToken.IndexedStringConsumer
Interface representing instance methods that consume indexed string values.static interface
ParseToken.IntConsumer
Interface representing instance methods that consume integer values.static interface
ParseToken.IntegerArrayConsumer
Interface representing instance methods that consume integer array.static interface
ParseToken.LabeledDoubleConsumer
Interface representing instance methods that consume labeled double values.static interface
ParseToken.ManeuvrableConsumer
Interface representing instance methods that consume Maneuvrable values.static interface
ParseToken.RotationOrderConsumer
Interface representing instance methods that consume otation order values.static interface
ParseToken.StringConsumer
Interface representing instance methods that consume string values.static interface
ParseToken.StringListConsumer
Interface representing instance methods that consume lists of strings values.static interface
ParseToken.TimeSystemConsumer
Interface representing instance methods that consume time systems values.static interface
ParseToken.UnitListConsumer
Interface representing instance methods that consume units lists values.static interface
ParseToken.VectorConsumer
Interface representing instance methods that consume vector values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OrekitException
generateException(Exception cause)
Generate a parse exception for this entry.boolean
getContentAsBoolean()
Get the content of the entry as a boolean.double
getContentAsDouble()
Get the content of the entry as a double.<T extends Enum<T>>
TgetContentAsEnum(Class<T> cls)
Get the content of the entry as an enum.<T extends Enum<T>>
List<T>getContentAsEnumList(Class<T> cls)
Get the content of the entry as a list of enum.List<String>
getContentAsFreeTextList()
Get the content of the entry as a list of free-text strings.int
getContentAsInt()
Get the content of the entry as an integer.List<String>
getContentAsNormalizedList()
Get the content of the entry as a list of normalized strings.String
getContentAsNormalizedString()
Get the content of the entry.char
getContentAsUppercaseCharacter()
Get the content of the entry as an uppercase character.List<String>
getContentAsUppercaseList()
Get the content of the entry as a list of normalized and uppercased strings.String
getContentAsUppercaseString()
Get the content of the entry as normalized and uppercased.Vector3D
getContentAsVector()
Get the content of the entry as a vector.String
getFileName()
Get the name of the file.int
getLineNumber()
Get the number of the line in the CCSDS data message.String
getName()
Get the name of the block or entry.String
getRawContent()
Get the raw content of the entry.TokenType
getType()
Get the type of the token.Unit
getUnits()
Get the units.boolean
processAsBoolean(ParseToken.BooleanConsumer consumer)
Process the content as a boolean.boolean
processAsCenter(ParseToken.CenterConsumer consumer, CelestialBodies celestialBodies)
Process the content as a body center.boolean
processAsCenterList(ParseToken.CenterListConsumer consumer, CelestialBodies celestialBodies)
Process the content as a body center list.boolean
processAsDate(ParseToken.DateConsumer consumer, ContextBinding context)
Process the content as a date.boolean
processAsDouble(Unit standard, ParsedUnitsBehavior behavior, ParseToken.DoubleConsumer consumer)
Process the content as a double.boolean
processAsDoubleArray(Unit standard, ParsedUnitsBehavior behavior, ParseToken.DoubleArrayConsumer consumer)
Process the content as an array of doubles.boolean
processAsDoublyIndexedDouble(int i, int j, Unit standard, ParsedUnitsBehavior behavior, ParseToken.DoublyIndexedDoubleConsumer consumer)
Process the content as a doubly-indexed double.<T extends Enum<T>>
booleanprocessAsEnum(Class<T> cls, ParseToken.EnumConsumer<T> consumer)
Process the content as an enum.<T extends Enum<T>>
booleanprocessAsEnumsList(Class<T> cls, ParseToken.EnumListConsumer<T> consumer)
Process the content as a list of enums.boolean
processAsFrame(ParseToken.FrameConsumer consumer, ContextBinding context, boolean allowCelestial, boolean allowOrbit, boolean allowSpacecraft)
Process the content as a frame.boolean
processAsFreeTextList(ParseToken.StringListConsumer consumer)
Process the content as a list of free-text strings.boolean
processAsFreeTextString(ParseToken.StringConsumer consumer)
Process the content as free text string.boolean
processAsIndexedDouble(int i, Unit standard, ParsedUnitsBehavior behavior, ParseToken.IndexedDoubleConsumer consumer)
Process the content as an indexed double.boolean
processAsIndexedDoubleArray(int index, Unit standard, ParsedUnitsBehavior behavior, ParseToken.IndexedDoubleArrayConsumer consumer)
Process the content as an indexed double array.boolean
processAsIndexedInteger(int index, ParseToken.IndexedIntConsumer consumer)
Process the content as an indexed integer.boolean
processAsIndexedNormalizedString(int index, ParseToken.IndexedStringConsumer consumer)
Process the content as an indexed normalized string.boolean
processAsIndexedUppercaseString(int index, ParseToken.IndexedStringConsumer consumer)
Process the content as an indexed normalized uppercase string.boolean
processAsInteger(ParseToken.IntConsumer consumer)
Process the content as an integer.boolean
processAsIntegerArray(ParseToken.IntegerArrayConsumer consumer)
Process the content as an array of integers.boolean
processAsIntegerArrayNoSpace(ParseToken.IntegerArrayConsumer consumer)
Process the content as an array of integers.boolean
processAsLabeledDouble(char label, Unit standard, ParsedUnitsBehavior behavior, ParseToken.LabeledDoubleConsumer consumer)
Process the content as a labeled double.boolean
processAsManeuvrableEnum(ParseToken.ManeuvrableConsumer consumer)
Process the content of the Maneuvrable enum.boolean
processAsNormalizedCharacter(ParseToken.CharConsumer consumer)
Process the content as a normalized character.boolean
processAsNormalizedList(ParseToken.StringListConsumer consumer)
Process the content as a list of normalized strings.boolean
processAsNormalizedString(ParseToken.StringConsumer consumer)
Process the content as a normalized string.boolean
processAsRotationOrder(ParseToken.RotationOrderConsumer consumer)
Process the content as a rotation sequence.boolean
processAsTimeSystem(ParseToken.TimeSystemConsumer consumer)
Process the content as a time system.boolean
processAsUnitList(ParseToken.UnitListConsumer consumer)
Process the content as a list of units.boolean
processAsUppercaseList(ParseToken.StringListConsumer consumer)
Process the content as a list of normalized uppercase strings.boolean
processAsUppercaseString(ParseToken.StringConsumer consumer)
Process the content as a normalized uppercase string.boolean
processAsVector(Unit standard, ParsedUnitsBehavior behavior, ParseToken.VectorConsumer consumer)
Process the content as a vector.
-
-
-
Constructor Detail
-
ParseToken
public ParseToken(TokenType type, String name, String content, Unit units, int lineNumber, String fileName)
Simple constructor.- Parameters:
type
- type of the tokenname
- name of the block or entrycontent
- entry contentunits
- units of the entrylineNumber
- number of the line in the CCSDS data messagefileName
- name of the file
-
-
Method Detail
-
getType
public TokenType getType()
Get the type of the token.- Returns:
- type of the token
-
getName
public String getName()
Get the name of the block or entry.- Returns:
- name of the block or entry
-
getRawContent
public String getRawContent()
Get the raw content of the entry.- Returns:
- entry raw content
-
getContentAsNormalizedString
public String getContentAsNormalizedString()
Get the content of the entry.Free-text strings are normalized by replacing all occurrences of '_' with space, and collapsing several spaces as one space only.
- Returns:
- entry content
-
getContentAsFreeTextList
public List<String> getContentAsFreeTextList()
Get the content of the entry as a list of free-text strings.- Returns:
- content of the entry as a list of free-test strings
- Since:
- 12.0
-
getContentAsNormalizedList
public List<String> getContentAsNormalizedList()
Get the content of the entry as a list of normalized strings.Normalization is performed by replacing all occurrences of '_' with space, and collapsing several spaces as one space only.
- Returns:
- content of the entry as a list of free-test strings
-
getContentAsUppercaseString
public String getContentAsUppercaseString()
Get the content of the entry as normalized and uppercased.- Returns:
- entry normalized and uppercased content
-
getContentAsUppercaseList
public List<String> getContentAsUppercaseList()
Get the content of the entry as a list of normalized and uppercased strings.- Returns:
- content of the entry as a list of normalized and uppercased strings
-
getContentAsEnum
public <T extends Enum<T>> T getContentAsEnum(Class<T> cls)
Get the content of the entry as an enum.- Type Parameters:
T
- type of the enum- Parameters:
cls
- enum class- Returns:
- entry content
-
getContentAsEnumList
public <T extends Enum<T>> List<T> getContentAsEnumList(Class<T> cls)
Get the content of the entry as a list of enum.- Type Parameters:
T
- type of the enum- Parameters:
cls
- enum class- Returns:
- entry content
-
getContentAsDouble
public double getContentAsDouble()
Get the content of the entry as a double.- Returns:
- content as a double
-
getContentAsVector
public Vector3D getContentAsVector()
Get the content of the entry as a vector.- Returns:
- content as a vector
-
getContentAsBoolean
public boolean getContentAsBoolean()
Get the content of the entry as a boolean.- Returns:
- content as a boolean
-
getContentAsInt
public int getContentAsInt()
Get the content of the entry as an integer.- Returns:
- content as an integer
-
getContentAsUppercaseCharacter
public char getContentAsUppercaseCharacter()
Get the content of the entry as an uppercase character.- Returns:
- content as an uppercase character
-
getUnits
public Unit getUnits()
Get the units.- Returns:
- units of the entry (may be null)
-
getLineNumber
public int getLineNumber()
Get the number of the line in the CCSDS data message.- Returns:
- number of the line in the CCSDS data message
-
getFileName
public String getFileName()
Get the name of the file.- Returns:
- name of the file
-
processAsNormalizedString
public boolean processAsNormalizedString(ParseToken.StringConsumer consumer)
Process the content as a normalized string.- Parameters:
consumer
- consumer of the normalized string- Returns:
- always returns
true
- See Also:
processAsUppercaseString(StringConsumer)
-
processAsUppercaseString
public boolean processAsUppercaseString(ParseToken.StringConsumer consumer)
Process the content as a normalized uppercase string.- Parameters:
consumer
- consumer of the normalized uppercase string- Returns:
- always returns
true
- See Also:
processAsNormalizedString(StringConsumer)
-
processAsIndexedNormalizedString
public boolean processAsIndexedNormalizedString(int index, ParseToken.IndexedStringConsumer consumer)
Process the content as an indexed normalized string.- Parameters:
index
- indexconsumer
- consumer of the indexed normalized string- Returns:
- always returns
true
-
processAsIndexedUppercaseString
public boolean processAsIndexedUppercaseString(int index, ParseToken.IndexedStringConsumer consumer)
Process the content as an indexed normalized uppercase string.- Parameters:
index
- indexconsumer
- consumer of the indexed normalized uppercase string- Returns:
- always returns
true
-
processAsFreeTextList
public boolean processAsFreeTextList(ParseToken.StringListConsumer consumer)
Process the content as a list of free-text strings.- Parameters:
consumer
- consumer of the free-text strings list- Returns:
- always returns
true
- Since:
- 12.0
-
processAsNormalizedList
public boolean processAsNormalizedList(ParseToken.StringListConsumer consumer)
Process the content as a list of normalized strings.- Parameters:
consumer
- consumer of the normalized strings list- Returns:
- always returns
true
-
processAsUppercaseList
public boolean processAsUppercaseList(ParseToken.StringListConsumer consumer)
Process the content as a list of normalized uppercase strings.- Parameters:
consumer
- consumer of the normalized uppercase strings list- Returns:
- always returns
true
-
processAsEnum
public <T extends Enum<T>> boolean processAsEnum(Class<T> cls, ParseToken.EnumConsumer<T> consumer)
Process the content as an enum.- Type Parameters:
T
- type of the enum- Parameters:
cls
- enum classconsumer
- consumer of the enum- Returns:
- always returns
true
-
processAsEnumsList
public <T extends Enum<T>> boolean processAsEnumsList(Class<T> cls, ParseToken.EnumListConsumer<T> consumer)
Process the content as a list of enums.- Type Parameters:
T
- type of the enum- Parameters:
cls
- enum classconsumer
- consumer of the enums list- Returns:
- always returns
true
-
processAsBoolean
public boolean processAsBoolean(ParseToken.BooleanConsumer consumer)
Process the content as a boolean.- Parameters:
consumer
- consumer of the boolean- Returns:
- always returns
true
-
processAsInteger
public boolean processAsInteger(ParseToken.IntConsumer consumer)
Process the content as an integer.- Parameters:
consumer
- consumer of the integer- Returns:
- always returns
true
-
processAsIndexedInteger
public boolean processAsIndexedInteger(int index, ParseToken.IndexedIntConsumer consumer)
Process the content as an indexed integer.- Parameters:
index
- indexconsumer
- consumer of the integer- Returns:
- always returns
true
- Since:
- 12.0
-
processAsIntegerArrayNoSpace
public boolean processAsIntegerArrayNoSpace(ParseToken.IntegerArrayConsumer consumer)
Process the content as an array of integers. No spaces between commas are allowed.- Parameters:
consumer
- consumer of the array- Returns:
- always returns
true
-
processAsIntegerArray
public boolean processAsIntegerArray(ParseToken.IntegerArrayConsumer consumer)
Process the content as an array of integers. Spaces are replaced by commas.- Parameters:
consumer
- consumer of the array- Returns:
- always returns
true
-
processAsNormalizedCharacter
public boolean processAsNormalizedCharacter(ParseToken.CharConsumer consumer)
Process the content as a normalized character.- Parameters:
consumer
- consumer of the normalized character- Returns:
- always returns
true
-
processAsDouble
public boolean processAsDouble(Unit standard, ParsedUnitsBehavior behavior, ParseToken.DoubleConsumer consumer)
Process the content as a double.- Parameters:
standard
- units of parsed content as specified by CCSDS standardbehavior
- behavior to adopt for parsed unitconsumer
- consumer of the double- Returns:
- always returns
true
-
processAsLabeledDouble
public boolean processAsLabeledDouble(char label, Unit standard, ParsedUnitsBehavior behavior, ParseToken.LabeledDoubleConsumer consumer)
Process the content as a labeled double.- Parameters:
label
- labelstandard
- units of parsed content as specified by CCSDS standardbehavior
- behavior to adopt for parsed unitconsumer
- consumer of the indexed double- Returns:
- always returns
true
-
processAsIndexedDouble
public boolean processAsIndexedDouble(int i, Unit standard, ParsedUnitsBehavior behavior, ParseToken.IndexedDoubleConsumer consumer)
Process the content as an indexed double.- Parameters:
i
- indexstandard
- units of parsed content as specified by CCSDS standardbehavior
- behavior to adopt for parsed unitconsumer
- consumer of the indexed double- Returns:
- always returns
true
-
processAsDoublyIndexedDouble
public boolean processAsDoublyIndexedDouble(int i, int j, Unit standard, ParsedUnitsBehavior behavior, ParseToken.DoublyIndexedDoubleConsumer consumer)
Process the content as a doubly-indexed double.- Parameters:
i
- first indexj
- second indexstandard
- units of parsed content as specified by CCSDS standardbehavior
- behavior to adopt for parsed unitconsumer
- consumer of the doubly-indexed double- Returns:
- always returns
true
-
processAsDoubleArray
public boolean processAsDoubleArray(Unit standard, ParsedUnitsBehavior behavior, ParseToken.DoubleArrayConsumer consumer)
Process the content as an array of doubles.- Parameters:
standard
- units of parsed content as specified by CCSDS standardbehavior
- behavior to adopt for parsed unitconsumer
- consumer of the array- Returns:
- always returns
true
- Since:
- 12.0
-
processAsIndexedDoubleArray
public boolean processAsIndexedDoubleArray(int index, Unit standard, ParsedUnitsBehavior behavior, ParseToken.IndexedDoubleArrayConsumer consumer)
Process the content as an indexed double array.- Parameters:
index
- indexstandard
- units of parsed content as specified by CCSDS standardbehavior
- behavior to adopt for parsed unitconsumer
- consumer of the indexed double array- Returns:
- always returns
true
- Since:
- 12.0
-
processAsVector
public boolean processAsVector(Unit standard, ParsedUnitsBehavior behavior, ParseToken.VectorConsumer consumer)
Process the content as a vector.- Parameters:
standard
- units of parsed content as specified by CCSDS standardbehavior
- behavior to adopt for parsed unitconsumer
- consumer of the vector- Returns:
- always returns
true
(or throws an exception)
-
processAsDate
public boolean processAsDate(ParseToken.DateConsumer consumer, ContextBinding context)
Process the content as a date.- Parameters:
consumer
- consumer of the datecontext
- context binding- Returns:
- always returns
true
(or throws an exception)
-
processAsTimeSystem
public boolean processAsTimeSystem(ParseToken.TimeSystemConsumer consumer)
Process the content as a time system.- Parameters:
consumer
- consumer of the time system- Returns:
- always returns
true
(or throws an exception)
-
processAsFrame
public boolean processAsFrame(ParseToken.FrameConsumer consumer, ContextBinding context, boolean allowCelestial, boolean allowOrbit, boolean allowSpacecraft)
Process the content as a frame.- Parameters:
consumer
- consumer of the framecontext
- context bindingallowCelestial
- if true,CelestialBodyFrame
are allowedallowOrbit
- if true,OrbitRelativeFrame
are allowedallowSpacecraft
- if true,SpacecraftBodyFrame
are allowed- Returns:
- always returns
true
-
processAsCenter
public boolean processAsCenter(ParseToken.CenterConsumer consumer, CelestialBodies celestialBodies)
Process the content as a body center.- Parameters:
consumer
- consumer of the body centercelestialBodies
- factory for celestial bodies- Returns:
- always returns
true
-
processAsCenterList
public boolean processAsCenterList(ParseToken.CenterListConsumer consumer, CelestialBodies celestialBodies)
Process the content as a body center list.- Parameters:
consumer
- consumer of the body center listcelestialBodies
- factory for celestial bodies- Returns:
- always returns
true
-
processAsRotationOrder
public boolean processAsRotationOrder(ParseToken.RotationOrderConsumer consumer)
Process the content as a rotation sequence.- Parameters:
consumer
- consumer of the rotation sequence- Returns:
- always returns
true
- Since:
- 12.0
-
processAsUnitList
public boolean processAsUnitList(ParseToken.UnitListConsumer consumer)
Process the content as a list of units.- Parameters:
consumer
- consumer of the time scale- Returns:
- always returns
true
(or throws an exception)
-
processAsFreeTextString
public boolean processAsFreeTextString(ParseToken.StringConsumer consumer)
Process the content as free text string.- Parameters:
consumer
- consumer of the string- Returns:
- always returns
true
-
processAsManeuvrableEnum
public boolean processAsManeuvrableEnum(ParseToken.ManeuvrableConsumer consumer)
Process the content of the Maneuvrable enum.- Parameters:
consumer
- consumer of the enum- Returns:
- always returns
true
-
generateException
public OrekitException generateException(Exception cause)
Generate a parse exception for this entry.- Parameters:
cause
- underlying cause exception (may be null)- Returns:
- exception for this entry
-
-