public interface Generator extends AutoCloseable
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the generator.
|
String |
dateToString(int year,
int month,
int day,
int hour,
int minute,
double seconds)
Convert a date to string value with high precision.
|
String |
dateToString(TimeConverter converter,
AbsoluteDate date)
Convert a date to string value with high precision.
|
String |
doubleToString(double value)
Convert a double to string value with high precision.
|
void |
endMessage(String root)
End CCSDS message.
|
void |
enterSection(String name)
Enter into a new section.
|
String |
exitSection()
Exit last section.
|
FileFormat |
getFormat()
Get the generated file format.
|
String |
getOutputName()
Get the name of the output (for error messages).
|
void |
newLine()
Finish current line.
|
String |
siToCcsdsName(String siName)
Convert a SI unit name to a CCSDS name.
|
void |
startMessage(String root,
String messageTypeKey,
double version)
Start CCSDS message.
|
String |
unitsListToString(List<Unit> units)
Convert a list of units to a bracketed string.
|
void |
writeComments(List<String> comments)
Write comment lines.
|
void |
writeEntry(String key,
char value,
boolean mandatory)
Write a single key/value entry.
|
void |
writeEntry(String key,
double value,
Unit unit,
boolean mandatory)
Write a single key/value entry.
|
void |
writeEntry(String key,
Double value,
Unit unit,
boolean mandatory)
Write a single key/value entry.
|
void |
writeEntry(String key,
Enum<?> value,
boolean mandatory)
Write a single key/value entry.
|
void |
writeEntry(String key,
int value,
boolean mandatory)
Write a single key/value entry.
|
void |
writeEntry(String key,
List<String> value,
boolean mandatory)
Write a single key/value entry.
|
void |
writeEntry(String key,
String value,
Unit unit,
boolean mandatory)
Write a single key/value entry.
|
void |
writeEntry(String key,
TimeConverter converter,
AbsoluteDate date,
boolean mandatory)
Write a single key/value entry.
|
void |
writeRawData(char data)
Write raw data.
|
void |
writeRawData(CharSequence data)
Write raw data.
|
String getOutputName()
FileFormat getFormat()
void startMessage(String root, String messageTypeKey, double version) throws IOException
messageTypeKey
- key for message typeroot
- root element for XML filesversion
- format versionIOException
- if an I/O error occurs.void endMessage(String root) throws IOException
root
- root element for XML filesIOException
- if an I/O error occurs.void writeComments(List<String> comments) throws IOException
comments
- comments to writeIOException
- if an I/O error occurs.void writeEntry(String key, String value, Unit unit, boolean mandatory) throws IOException
key
- the keyword to writevalue
- the value to writeunit
- output unit (may be null)mandatory
- if true, null values triggers exception, otherwise they are silently ignoredIOException
- if an I/O error occurs.void writeEntry(String key, List<String> value, boolean mandatory) throws IOException
key
- the keyword to writevalue
- the value to writemandatory
- if true, null values triggers exception, otherwise they are silently ignoredIOException
- if an I/O error occurs.void writeEntry(String key, Enum<?> value, boolean mandatory) throws IOException
key
- the keyword to writevalue
- the value to writemandatory
- if true, null values triggers exception, otherwise they are silently ignoredIOException
- if an I/O error occurs.void writeEntry(String key, TimeConverter converter, AbsoluteDate date, boolean mandatory) throws IOException
key
- the keyword to writeconverter
- converter to use for datesdate
- the date to writemandatory
- if true, null values triggers exception, otherwise they are silently ignoredIOException
- if an I/O error occurs.void writeEntry(String key, char value, boolean mandatory) throws IOException
key
- the keyword to writevalue
- the value to writemandatory
- if true, null values triggers exception, otherwise they are silently ignoredIOException
- if an I/O error occurs.void writeEntry(String key, int value, boolean mandatory) throws IOException
key
- the keyword to writevalue
- the value to writemandatory
- if true, null values triggers exception, otherwise they are silently ignoredIOException
- if an I/O error occurs.void writeEntry(String key, double value, Unit unit, boolean mandatory) throws IOException
key
- the keyword to writevalue
- the value to write (in SI units)unit
- output unitmandatory
- if true, null values triggers exception, otherwise they are silently ignoredIOException
- if an I/O error occurs.void writeEntry(String key, Double value, Unit unit, boolean mandatory) throws IOException
key
- the keyword to writevalue
- the value to write (in SI units)unit
- output unitmandatory
- if true, null values triggers exception, otherwise they are silently ignoredIOException
- if an I/O error occurs.void newLine() throws IOException
IOException
- if an I/O error occurs.void writeRawData(char data) throws IOException
data
- raw data to writeIOException
- if an I/O error occurs.void writeRawData(CharSequence data) throws IOException
data
- raw data to writeIOException
- if an I/O error occurs.void enterSection(String name) throws IOException
name
- section nameIOException
- if an I/O error occurs.String exitSection() throws IOException
IOException
- if an I/O error occurs.void close() throws IOException
close
in interface AutoCloseable
IOException
- if an I/O error occurs.String dateToString(TimeConverter converter, AbsoluteDate date)
converter
- converter for datesdate
- date to writeString dateToString(int year, int month, int day, int hour, int minute, double seconds)
year
- yearmonth
- monthday
- dayhour
- hourminute
- minuteseconds
- secondsString doubleToString(double value)
We don't want to loose internal accuracy when writing doubles but we also don't want to have ugly representations like STEP = 1.25000000000000000 so we try a few simple formats first and fall back to scientific notation if it doesn't work.
value
- value to formatDouble.NaN
String unitsListToString(List<Unit> units)
units
- lists to output (may be null or empty)Copyright © 2002-2022 CS GROUP. All rights reserved.