|
ContactCenters V. 0.9.9. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectumontreal.iro.lecuyer.util.DefaultDoubleFormatter
public class DefaultDoubleFormatter
Default formatter.
Let x be a value to be formatted. Let d1 be the number of needed
significant digits for | x|≤1, and d2 be the number of digits for
| x| > 1. If
x≥10d1, the formatter uses PrintfFormat.f(double) with 0
decimal digit of precision. If
x < 10-d2, the formatter uses
PrintfFormat.e(double) with d2 digits of precision. Otherwise, the
formatter uses PrintfFormat.g(double) with d1 or d2 significant digits,
depending if | x| is smaller than or equal to 1, or greater than 1.
| Constructor Summary | |
|---|---|
DefaultDoubleFormatter()
Constructs a formatter that uses 3 significant digits for all numbers. |
|
DefaultDoubleFormatter(int digitsSmall,
int digitsLarge)
Constructs a formatter that uses digitsSmall significant digits for values smaller than 1, and digitsLarge significant digits for other values. |
|
| Method Summary | |
|---|---|
String |
format(double x)
Formats the double x as a string, and returns the resulting string. |
int |
getDigitsLarge()
Returns the number of significant digits for values greater than or equal to 1. |
int |
getDigitsSmall()
Returns the number of significant digits for values smaller than 1. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultDoubleFormatter()
public DefaultDoubleFormatter(int digitsSmall,
int digitsLarge)
digitsSmall - the number of significant digits for values smaller than 1.digitsLarge - the number of significant digits for values greater than or
equal to 1.| Method Detail |
|---|
public int getDigitsSmall()
public int getDigitsLarge()
public String format(double x)
DoubleFormatter
format in interface DoubleFormatterx - the value being formatted.
|
ContactCenters V. 0.9.9. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||