|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--lava.text.StringJustifier | +--lava.text.NumberFormatter
A NumberFormatter
formats numbers according to criteria selected by the user. The user can control various formatting parameters, such as field width, justification style (left-align, right-align, center, etc.), padding characters, etc.
Since applications which must format numbers frequently format more than one number with the same style, this class is designed to "remember" selected formatting parameters so that they can be reused with each format call. This approach reduces the amount of parameters which must be passed during each format call and results in more efficient execution.
This is an abstract class. Consult the documentation for subclasses lava.math.IntegerFormatter and lava.math.RealFormatter for examples on how this class is used.
Formatting parameters can be updated at any time, and doing so will change the way text is formatted afterwards. For a detailed description of user-controllable parameters, consult the documentation below.
IntegerFormatter
,
RealFormatter
Field Summary | |
java.lang.String |
neg_prefix
Prefix for negative numbers. |
java.lang.String |
neg_suffix
Suffix for negative numbers. |
java.lang.String |
pos_prefix
Prefix for positive numbers. |
java.lang.String |
pos_suffix
Suffix for positive numbers. |
int |
radix
Radix of the numbers to format. |
int |
sig_digits
Number of significant digits to display in the output. |
boolean |
uppercase
Indicates whether uppercase digits will be used. |
java.lang.String |
zero_prefix
Prefix when number is zero. |
java.lang.String |
zero_suffix
Suffix when number is zero. |
Fields inherited from class lava.text.StringJustifier |
cropping,
field_width,
justification,
pad_char |
Constructor Summary | |
protected |
NumberFormatter()
Initializes a new NumberFormatter with default settings. |
Methods inherited from class lava.text.StringJustifier |
format,
format,
toString |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public int radix
radix
to 16 results in hexadecimal output. Default value: 10
.public boolean uppercase
radix
> 10. Default value: false
.public int sig_digits
public java.lang.String pos_prefix
public java.lang.String pos_suffix
public java.lang.String zero_prefix
public java.lang.String zero_suffix
public java.lang.String neg_prefix
public java.lang.String neg_suffix
Constructor Detail |
protected NumberFormatter()
|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |