Class ScientificNumberFormat
- java.lang.Object
-
- java.text.Format
-
- java.text.NumberFormat
-
- com.inductiveautomation.ignition.common.util.ScientificNumberFormat
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class ScientificNumberFormat extends java.text.NumberFormat
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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ScientificNumberFormat()
Creates 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(java.lang.String largeFormat, java.lang.String smallFormat, double threshold)
Creates a scientific number format with custom large and small formats
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.swing.JFormattedTextField
createEditor()
Creates an editor that uses this formatter as its decimal formatjava.lang.StringBuffer
format(double number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
java.lang.StringBuffer
format(long number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
static ScientificNumberFormat
getShared()
java.lang.Number
parse(java.lang.String source, java.text.ParsePosition parsePosition)
-
Methods inherited from class java.text.NumberFormat
clone, equals, format, format, format, getAvailableLocales, 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
-
-
-
-
Constructor Detail
-
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
public ScientificNumberFormat(java.lang.String largeFormat, java.lang.String smallFormat, double threshold)
Creates a scientific number format with custom large and small formats
-
-
Method Detail
-
getShared
public static ScientificNumberFormat getShared()
-
format
public java.lang.StringBuffer format(double number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
- Specified by:
format
in classjava.text.NumberFormat
-
format
public java.lang.StringBuffer format(long number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
- Specified by:
format
in classjava.text.NumberFormat
-
parse
public java.lang.Number parse(java.lang.String source, java.text.ParsePosition parsePosition)
- Specified by:
parse
in classjava.text.NumberFormat
-
createEditor
public javax.swing.JFormattedTextField createEditor()
Creates an editor that uses this formatter as its decimal format
-
-