Package org.orekit.utils.formatting
Class FastScientificFormatter
- java.lang.Object
-
- org.orekit.utils.formatting.FastDoubleFormatter
-
- org.orekit.utils.formatting.FastScientificFormatter
-
public class FastScientificFormatter extends FastDoubleFormatter
Formatter for double numbers in scientific format with low overhead.This class is intended to be used when formatting large amounts of data with fixed scientific formats like, for example, large ephemeris or measurement files.
Building the formatter is done once, and the formatter
FastDoubleFormatter.appendTo(Appendable, double)orFastDoubleFormatter.toString(double)methods can be called hundreds of thousands of times, without incurring the overhead that would occur withString.format(). Some tests showed this formatter is about 6-7 times faster thanString.format()with%{width}.{%precision}eformat.Instances of this class are immutable
- Since:
- 14.0
- Author:
- Luc Maisonobe
-
-
Constructor Summary
Constructors Constructor Description FastScientificFormatter(int width)Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendRegularValueTo(Appendable appendable, double value)Append one formatted value to anAppendable.-
Methods inherited from class org.orekit.utils.formatting.FastDoubleFormatter
appendTo, getWidth, toString
-
-
-
-
Constructor Detail
-
FastScientificFormatter
public FastScientificFormatter(int width)
Simple constructor.This constructor is equivalent to
Formatterfloat format%{width}.{width-7}e- Parameters:
width- number of characters to output
-
-
Method Detail
-
appendRegularValueTo
protected void appendRegularValueTo(Appendable appendable, double value) throws IOException
Append one formatted value to anAppendable.- Specified by:
appendRegularValueToin classFastDoubleFormatter- Parameters:
appendable- to append value tovalue- value to format- Throws:
IOException- if an I/O error occurs
-
-