Package org.orekit.utils
Class AccurateFormatter
- java.lang.Object
-
- org.orekit.utils.AccurateFormatter
-
- All Implemented Interfaces:
Formatter
public class AccurateFormatter extends Object implements Formatter
Formatter used to produce strings from data with high accuracy.When producing test output from computed data, we want the shortest decimal representation of a floating point number that maintains round-trip safety. That is, a correct parser can recover the exact original number.
For efficiency, this class uses the
Ryū
algorithm for producing shortest string representation with round-trip safety.- Since:
- 11.0
- Author:
- Luc Maisonobe
-
-
Field Summary
-
Fields inherited from interface org.orekit.utils.Formatter
DATE_FORMAT, STANDARDIZED_LOCALE
-
-
Constructor Summary
Constructors Constructor Description AccurateFormatter()
Public constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static String
format(double value)
Deprecated.As of 13.0, because Static method does not utilize inheritance benefits fromFormatter
.static String
format(int year, int month, int day, int hour, int minute, double seconds)
Deprecated.As of 13.0, because static method does not utilize inheritance benefits fromFormatter
and does not check format standards of date time.String
toString(double value)
Formats to full accuracy.String
toString(int year, int month, int day, int hour, int minute, double seconds)
Formats the seconds variable with maximum precision needed.
-
-
-
Method Detail
-
toString
public String toString(double value)
Formats to full accuracy. Format a double number.
-
toString
public String toString(int year, int month, int day, int hour, int minute, double seconds)
Formats the seconds variable with maximum precision needed. Format a date. Does not check if date time is real or if it will meet formating requirements.- Specified by:
toString
in interfaceFormatter
- Parameters:
year
- of date to be formattedmonth
- of date to be formattedday
- of month to be formattedhour
- to be formattedminute
- to be formattedseconds
- and sub-seconds to be formatted- Returns:
- date formatted to match the following format [yyyy-MM-ddTHH:mm:ss.S#]
-
format
@Deprecated public static String format(int year, int month, int day, int hour, int minute, double seconds)
Deprecated.As of 13.0, because static method does not utilize inheritance benefits fromFormatter
and does not check format standards of date time. UsetoString(int, int, int, int, int, double)
instead.Format a date.- Parameters:
year
- yearmonth
- monthday
- dayhour
- hourminute
- minuteseconds
- seconds- Returns:
- date formatted to full accuracy
-
format
@Deprecated public static String format(double value)
Deprecated.As of 13.0, because Static method does not utilize inheritance benefits fromFormatter
. UsetoString(double)
instead.Format a double number.- Parameters:
value
- number to format- Returns:
- number formatted to full accuracy
-
-