public class NumberFormatter
extends java.lang.Object
NumberFormatter is used to format the computed FunctionValue of a function node, when the value is a Number.
It allows formatting the result Number.
| Constructor and Description |
|---|
NumberFormatter(java.lang.String prefix,
java.lang.String suffix,
int digits,
boolean groupingUsed,
boolean scientificNotationUsed,
boolean percent,
boolean trailingZerosTrimmed)
Creates an instance of the formatter with the specified parameters.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getDigits()
Returns the number of decimals to display.
|
java.lang.String |
getPrefix()
Returns the prefix of the formatted Number.
|
java.lang.String |
getSuffix()
Returns the suffix of the formatted Number.
|
boolean |
isGroupingUsed()
Tests if the grouping (by 3) is used
|
boolean |
isPercent()
Tests if the percent format is used
|
boolean |
isScientificNotationUsed()
Tests if the scientific notation is used
|
boolean |
isTrailingZerosTrimmed()
Tests if the not useful decimal zeros are trimmed
|
void |
setDigits(int digits)
Sets the number of decimals to display.
|
void |
setGroupingUsed(boolean groupingUsed)
Sets the grouping of the numbers (by 3) to the given value
|
void |
setPercent(boolean percent)
Sets the percent format to the given value
|
void |
setPrefix(java.lang.String prefix)
Sets the prefix of the formatted Number.
|
void |
setScientificNotationUsed(boolean scientificNotationUsed)
Sets the scientific notation mode to the given value
|
void |
setSuffix(java.lang.String suffix)
Sets the suffix of the formatted Number.
|
void |
setTrailingZerosTrimmed(boolean trailingZerosTrimmed)
Sets the trim mode for the trailing zeros to the given value
|
public NumberFormatter(java.lang.String prefix,
java.lang.String suffix,
int digits,
boolean groupingUsed,
boolean scientificNotationUsed,
boolean percent,
boolean trailingZerosTrimmed)
prefix - a String written before the formatted Numbersuffix - a String written after the formatted Numberdigits - an int representing the number of decimals to displaygroupingUsed - tells whether or not the groups of 3 numbers are separatedscientificNotationUsed - indicates if the number is formatted with E+0 scientific notationpercent - tells if the number is converted in percentt and displayed with %trailingZerosTrimmed - removes the decimal zeros that are not usefulpublic java.lang.String getPrefix()
String representing the prefix of null if there is no prefixpublic void setPrefix(java.lang.String prefix)
prefix - a String representing the prefix of null if there is no prefixpublic java.lang.String getSuffix()
String representing the suffix of null if there is no suffixpublic void setSuffix(java.lang.String suffix)
suffix - a String representing the suffix of null if there is no suffixpublic int getDigits()
int representing the number of decimals displayedpublic void setDigits(int digits)
digits - the number of decimal to display between 0 and 14public boolean isGroupingUsed()
public void setGroupingUsed(boolean groupingUsed)
groupingUsed - the grouping mode to usepublic boolean isScientificNotationUsed()
public void setScientificNotationUsed(boolean scientificNotationUsed)
scientificNotationUsed - the scientific notation to usepublic boolean isPercent()
public void setPercent(boolean percent)
percent - the percent format to usepublic boolean isTrailingZerosTrimmed()
public void setTrailingZerosTrimmed(boolean trailingZerosTrimmed)
trailingZerosTrimmed - the trim mode to use