Class AbstractMessageParser<T>
java.lang.Object
org.orekit.files.ccsds.utils.parsing.AbstractMessageParser<T>
- Type Parameters:
T- type of the file
- All Implemented Interfaces:
MessageParser<T>
- Direct Known Subclasses:
AbstractConstituentParser,NdmParser
Parser for CCSDS messages.
Note than starting with Orekit 11.0, CCSDS message parsers are
mutable objects that gather the data being parsed, until the
message is complete and the parseMessage method has returned. This implies that parsers
should not be used in a multi-thread context. The recommended
way to use parsers is to either dedicate one parser for each message
and drop it afterwards, or to use a single-thread loop.
- Since:
- 11.0
- Author:
- Luc Maisonobe
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMessageParser(String root, String formatVersionKey, Function<ParseToken, List<ParseToken>>[] filters) Simple constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidanticipateNext(ProcessingState anticipated) Anticipate what next processing state should be.Get the current processing state.Get the file format of the last message parsed.Get the key for format version.Get the non-default token builders for special XML elements.parseMessage(DataSource source) Parse a data source.voidprocess(ParseToken token) Process a parse token.protected voidreset(FileFormat fileFormat, ProcessingState initialState) Reset parser to initial state before parsing.voidsetEndTagSeen(boolean endTagSeen) Set the flag for XML end tag.voidsetFallback(ProcessingState fallback) Set fallback processing state.booleanCheck if XML end tag has been seen.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.orekit.files.ccsds.utils.lexical.MessageParser
build, reset
-
Constructor Details
-
AbstractMessageParser
protected AbstractMessageParser(String root, String formatVersionKey, Function<ParseToken, List<ParseToken>>[] filters) Simple constructor.- Parameters:
root- root element for XML filesformatVersionKey- key for format versionfilters- filters to apply to parse tokens- Since:
- 12.0
-
-
Method Details
-
setFallback
Set fallback processing state.The fallback processing state is used if anticipated state fails to parse the token.
- Parameters:
fallback- processing state to use if anticipated state does not work
-
reset
Reset parser to initial state before parsing.- Parameters:
fileFormat- format of the file ready to be parsedinitialState- initial processing state
-
setEndTagSeen
public void setEndTagSeen(boolean endTagSeen) Set the flag for XML end tag.- Parameters:
endTagSeen- if true, the XML end tag has been seen
-
wasEndTagSeen
public boolean wasEndTagSeen()Check if XML end tag has been seen.- Returns:
- true if XML end tag has been seen
-
getCurrent
Get the current processing state.- Returns:
- current processing state
-
getFileFormat
Get the file format of the last message parsed.- Specified by:
getFileFormatin interfaceMessageParser<T>- Returns:
- file format of the last message parsed
-
parseMessage
Parse a data source.- Specified by:
parseMessagein interfaceMessageParser<T>- Parameters:
source- data source to parse- Returns:
- parsed file
-
getFormatVersionKey
Get the key for format version.- Specified by:
getFormatVersionKeyin interfaceMessageParser<T>- Returns:
- format version key
-
getSpecialXmlElementsBuilders
Get the non-default token builders for special XML elements.- Specified by:
getSpecialXmlElementsBuildersin interfaceMessageParser<T>- Returns:
- map of token builders for special XML elements (keyed by XML element name)
-
anticipateNext
Anticipate what next processing state should be.- Parameters:
anticipated- anticipated next processing state
-
process
Process a parse token.- Specified by:
processin interfaceMessageParser<T>- Parameters:
token- token to process
-