Package quadbase.reportdesigner.util
Class NumericFormat
java.lang.Object
quadbase.reportdesigner.util.NumericFormat
- All Implemented Interfaces:
IFormat
NumericFormat
NumericalFormat is a utility class to format numeric value. You can specify the no of decimal point, currency symbol, thousand separator etc.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionintcurrency position, 0 - before number (default), 1 - after negative sign, 2 - after number .charDeprecated.intdecimal point, range from 1 to 6, default 2chardecimal point char, default '.'booleanleading zero, 0 or 1intnegative position, 0 - before currency sign (default), 1 - after currency sign, 2 - end of numberbooleanDeprecated.not used.intno.booleaneither 0 or 1, invalid when not currency, default 0charthousand separator, if 'N' means no thousand separator.Fields inherited from interface quadbase.reportdesigner.util.IFormat
BARCODE, DATETIME, IMAGEURL, LOCALEDATETIME, LOCALENUMERIC, LOGICAL, NUMERIC, STRING, TEXTURL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NumericFormatcreateFormat(String text) For internal use onlyDefine quadbase.reportdesigner.util.IFormat Use the doubleValue() method in java.lang.Number to return a formatted string If the target object is not an instance of Number, use the default toString() methodGet custom multi-character currency symbol Deprecates the old char type currency symbol variable "currencySymbol"intDefine quadbase.reportdesigner.util.IFormat Return the type of quadbase.reportdesigner.util.IFormatFor internal use onlyoutput(double d) Output the formatted numbervoidsetCustomCurrency(String customCurrency) Set custom multi-character currency symbol Deprecates the old char type currency symbol variable "currencySymbol"voidSet all variables to default valuevoidsetFormat(char currSymInit, boolean oneSymPerPageInit, int currencyPosInit, int decimalInit, int roundingInit, int negativeInit, char decimalSepInit, char thousandSepInit, boolean leadingZeroInit) Set Numeric formatvoidsetFormat(char currSymInit, boolean oneSymPerPageInit, int currencyPosInit, int decimalInit, int roundingInit, int negativeInit, char decimalSepInit, char thousandSepInit, boolean leadingZeroInit, String customCurrency) Set Numeric formatvoidsetScientifExp(int precision) Set scientific expressiontoString()For internal use onlyvoidwriteCustomCurrency(quadbase.common.util.internal.VersioningDataOutput out)
-
Field Details
-
sciExp
public boolean sciExpeither 0 or 1, invalid when not currency, default 0 -
currencySymbol
Deprecated.currency symbol, default none -
oneSymPerPage
Deprecated.not used.Not used. Always false. -
currencyPos
public int currencyPoscurrency position, 0 - before number (default), 1 - after negative sign, 2 - after number . invalid when not currency -
decimal
public int decimaldecimal point, range from 1 to 6, default 2 -
rounding
public int roundingno. of significant digit, range from 1 to 12, default 1 -
negative
public int negativenegative position, 0 - before currency sign (default), 1 - after currency sign, 2 - end of number -
decimalSep
public char decimalSepdecimal point char, default '.' -
thousandSep
public char thousandSepthousand separator, if 'N' means no thousand separator. 1000, default ',' -
leadingZero
public boolean leadingZeroleading zero, 0 or 1
-
-
Constructor Details
-
NumericFormat
public NumericFormat()Create a new numeric format with default values
-
-
Method Details
-
getCustomCurrency
Get custom multi-character currency symbol Deprecates the old char type currency symbol variable "currencySymbol" -
setCustomCurrency
Set custom multi-character currency symbol Deprecates the old char type currency symbol variable "currencySymbol" -
getFormatType
public int getFormatType()Define quadbase.reportdesigner.util.IFormat Return the type of quadbase.reportdesigner.util.IFormat- Specified by:
getFormatTypein interfaceIFormat- Returns:
- IFormat.NUMERIC
-
format
Define quadbase.reportdesigner.util.IFormat Use the doubleValue() method in java.lang.Number to return a formatted string If the target object is not an instance of Number, use the default toString() method -
setDefault
public void setDefault()Set all variables to default value -
setScientifExp
public void setScientifExp(int precision) Set scientific expression- Parameters:
precision- no of decimal point
-
setFormat
public void setFormat(char currSymInit, boolean oneSymPerPageInit, int currencyPosInit, int decimalInit, int roundingInit, int negativeInit, char decimalSepInit, char thousandSepInit, boolean leadingZeroInit) Set Numeric format- Parameters:
currSymInit- currency symboloneSymPerPageInit- not used, always set to falsecurrencyPosInit- currency position 0-2decimalInit- no. of decimal pointroundingInit- no. of significant digitnegativeInit- negative symbol position 0-2decimalSepInit- decimal point symbolleadingZeroInit- leading zerothoudsandSepInit- thousands separator symbol, 'N' means no thousands separator
-
setFormat
public void setFormat(char currSymInit, boolean oneSymPerPageInit, int currencyPosInit, int decimalInit, int roundingInit, int negativeInit, char decimalSepInit, char thousandSepInit, boolean leadingZeroInit, String customCurrency) Set Numeric format- Parameters:
currSymInit- currency symboloneSymPerPageInit- not used, always set to falsecurrencyPosInit- currency position 0-2decimalInit- no. of decimal pointroundingInit- no. of significant digitnegativeInit- negative symbol position 0-2decimalSepInit- decimal point symbolleadingZeroInit- leading zerocustomCurrency- custom currency signthoudsandSepInit- thousands separator symbol, 'N' means no thousands separator
-
output
Output the formatted number- Parameters:
d- number to be formatted- Returns:
- formatted value
-
toString
For internal use only -
getTextFormat
For internal use only- Specified by:
getTextFormatin interfaceIFormat
-
createFormat
For internal use only- Throws:
Exception
-
writeCustomCurrency
public void writeCustomCurrency(quadbase.common.util.internal.VersioningDataOutput out) throws IOException - Throws:
IOException
-