Class ScientificNumberFormat
java.lang.Object
java.text.Format
java.text.NumberFormat
com.inductiveautomation.ignition.common.util.ScientificNumberFormat
- All Implemented Interfaces:
Serializable
,Cloneable
A number format that will switch between a "small" and "large" format depending on the magnitude of the value. If the
magnitude of the to-be-formatted value is below a settable threshold, then the small format will be used. Otherwise,
and if the value is exactly equal to 0.0, the large format will be used.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.text.NumberFormat
NumberFormat.Field, NumberFormat.Style
-
Field Summary
Fields inherited from class java.text.NumberFormat
FRACTION_FIELD, INTEGER_FIELD
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a Scientific number format with 10 significant digits and a threshold of 0.0001ScientificNumberFormat
(int significantDigits, double threshold) Creates a scientific number format with any number of significant digits and a custom thresholdScientificNumberFormat
(String largeFormat, String smallFormat, double threshold) Creates a scientific number format with custom large and small formats -
Method Summary
Modifier and TypeMethodDescriptionCreates an editor that uses this formatter as its decimal formatformat
(double number, StringBuffer toAppendTo, FieldPosition pos) format
(long number, StringBuffer toAppendTo, FieldPosition pos) static ScientificNumberFormat
parse
(String source, ParsePosition parsePosition) Methods inherited from class java.text.NumberFormat
clone, equals, format, format, format, getAvailableLocales, getCompactNumberInstance, getCompactNumberInstance, getCurrency, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, getRoundingMode, hashCode, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setCurrency, setGroupingUsed, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setParseIntegerOnly, setRoundingMode
Methods inherited from class java.text.Format
format, formatToCharacterIterator, parseObject
-
Constructor Details
-
ScientificNumberFormat
public ScientificNumberFormat()Creates a Scientific number format with 10 significant digits and a threshold of 0.0001 -
ScientificNumberFormat
public ScientificNumberFormat(int significantDigits, double threshold) Creates a scientific number format with any number of significant digits and a custom threshold -
ScientificNumberFormat
Creates a scientific number format with custom large and small formats
-
-
Method Details
-
format
- Specified by:
format
in classNumberFormat
-
format
- Specified by:
format
in classNumberFormat
-
parse
- Specified by:
parse
in classNumberFormat
-
createEditor
Creates an editor that uses this formatter as its decimal format