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 interfaceParseToken.BooleanConsumerInterface representing instance methods that consume boolean values.static interfaceParseToken.CenterConsumerInterface representing instance methods that consume center values.static interfaceParseToken.CenterListConsumerInterface representing instance methods that consume center lists.static interfaceParseToken.CharConsumerInterface representing instance methods that consume character values.static interfaceParseToken.DateConsumerInterface representing instance methods that consume date values.static interfaceParseToken.DoubleArrayConsumerInterface representing instance methods that consume double array.static interfaceParseToken.DoubleConsumerInterface representing instance methods that consume double values.static interfaceParseToken.DoublyIndexedDoubleConsumerInterface representing instance methods that consume doubly-indexed double values.static interfaceParseToken.EnumConsumer<T extends Enum<T>>Interface representing instance methods that consume enum values.static interfaceParseToken.EnumListConsumer<T extends Enum<T>>Interface representing instance methods that consume lists of enum values.static interfaceParseToken.FrameConsumerInterface representing instance methods that consume frame values.static interfaceParseToken.IndexedDoubleArrayConsumerInterface representing instance methods that consume indexed double array values.static interfaceParseToken.IndexedDoubleConsumerInterface representing instance methods that consume indexed double values.static interfaceParseToken.IndexedIntConsumerInterface representing instance methods that consume indexed integer values.static interfaceParseToken.IndexedStringConsumerInterface representing instance methods that consume indexed string values.static interfaceParseToken.IntConsumerInterface representing instance methods that consume integer values.static interfaceParseToken.IntegerArrayConsumerInterface representing instance methods that consume integer array.static interfaceParseToken.LabeledDoubleConsumerInterface representing instance methods that consume labeled double values.static interfaceParseToken.ManeuvrableConsumerInterface representing instance methods that consume Maneuvrable values.static interfaceParseToken.RotationOrderConsumerInterface representing instance methods that consume otation order values.static interfaceParseToken.StringConsumerInterface representing instance methods that consume string values.static interfaceParseToken.StringListConsumerInterface representing instance methods that consume lists of strings values.static interfaceParseToken.TimeSystemConsumerInterface representing instance methods that consume time systems values.static interfaceParseToken.UnitListConsumerInterface representing instance methods that consume units lists values.static interfaceParseToken.VectorConsumerInterface representing instance methods that consume vector values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OrekitExceptiongenerateException(Exception cause)Generate a parse exception for this entry.booleangetContentAsBoolean()Get the content of the entry as a boolean.doublegetContentAsDouble()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.intgetContentAsInt()Get the content of the entry as an integer.List<String>getContentAsNormalizedList()Get the content of the entry as a list of normalized strings.StringgetContentAsNormalizedString()Get the content of the entry.chargetContentAsUppercaseCharacter()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.StringgetContentAsUppercaseString()Get the content of the entry as normalized and uppercased.Vector3DgetContentAsVector()Get the content of the entry as a vector.StringgetFileName()Get the name of the file.intgetLineNumber()Get the number of the line in the CCSDS data message.StringgetName()Get the name of the block or entry.StringgetRawContent()Get the raw content of the entry.TokenTypegetType()Get the type of the token.UnitgetUnits()Get the units.booleanprocessAsBoolean(ParseToken.BooleanConsumer consumer)Process the content as a boolean.booleanprocessAsCenter(ParseToken.CenterConsumer consumer, CelestialBodies celestialBodies)Process the content as a body center.booleanprocessAsCenterList(ParseToken.CenterListConsumer consumer, CelestialBodies celestialBodies)Process the content as a body center list.booleanprocessAsDate(ParseToken.DateConsumer consumer, ContextBinding context)Process the content as a date.booleanprocessAsDouble(Unit standard, ParsedUnitsBehavior behavior, ParseToken.DoubleConsumer consumer)Process the content as a double.booleanprocessAsDoubleArray(Unit standard, ParsedUnitsBehavior behavior, ParseToken.DoubleArrayConsumer consumer)Process the content as an array of doubles.booleanprocessAsDoublyIndexedDouble(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.booleanprocessAsFrame(ParseToken.FrameConsumer consumer, ContextBinding context, boolean allowCelestial, boolean allowOrbit, boolean allowSpacecraft)Process the content as a frame.booleanprocessAsFreeTextList(ParseToken.StringListConsumer consumer)Process the content as a list of free-text strings.booleanprocessAsFreeTextString(ParseToken.StringConsumer consumer)Process the content as free text string.booleanprocessAsIndexedDouble(int i, Unit standard, ParsedUnitsBehavior behavior, ParseToken.IndexedDoubleConsumer consumer)Process the content as an indexed double.booleanprocessAsIndexedDoubleArray(int index, Unit standard, ParsedUnitsBehavior behavior, ParseToken.IndexedDoubleArrayConsumer consumer)Process the content as an indexed double array.booleanprocessAsIndexedInteger(int index, ParseToken.IndexedIntConsumer consumer)Process the content as an indexed integer.booleanprocessAsIndexedNormalizedString(int index, ParseToken.IndexedStringConsumer consumer)Process the content as an indexed normalized string.booleanprocessAsIndexedUppercaseString(int index, ParseToken.IndexedStringConsumer consumer)Process the content as an indexed normalized uppercase string.booleanprocessAsInteger(ParseToken.IntConsumer consumer)Process the content as an integer.booleanprocessAsIntegerArray(ParseToken.IntegerArrayConsumer consumer)Process the content as an array of integers.booleanprocessAsIntegerArrayNoSpace(ParseToken.IntegerArrayConsumer consumer)Process the content as an array of integers.booleanprocessAsLabeledDouble(char label, Unit standard, ParsedUnitsBehavior behavior, ParseToken.LabeledDoubleConsumer consumer)Process the content as a labeled double.booleanprocessAsManeuvrableEnum(ParseToken.ManeuvrableConsumer consumer)Process the content of the Maneuvrable enum.booleanprocessAsNormalizedCharacter(ParseToken.CharConsumer consumer)Process the content as a normalized character.booleanprocessAsNormalizedList(ParseToken.StringListConsumer consumer)Process the content as a list of normalized strings.booleanprocessAsNormalizedString(ParseToken.StringConsumer consumer)Process the content as a normalized string.booleanprocessAsRotationOrder(ParseToken.RotationOrderConsumer consumer)Process the content as a rotation sequence.booleanprocessAsTimeSystem(ParseToken.TimeSystemConsumer consumer)Process the content as a time system.booleanprocessAsUnitList(ParseToken.UnitListConsumer consumer)Process the content as a list of units.booleanprocessAsUppercaseList(ParseToken.StringListConsumer consumer)Process the content as a list of normalized uppercase strings.booleanprocessAsUppercaseString(ParseToken.StringConsumer consumer)Process the content as a normalized uppercase string.booleanprocessAsVector(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,CelestialBodyFrameare allowedallowOrbit- if true,OrbitRelativeFrameare allowedallowSpacecraft- if true,SpacecraftBodyFrameare 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
-
-