public class ExpFormatter implements NumberFormatter
static final NumberFormatter |
percent
Inherited from NumberFormatter. |
final int |
base
Exponent base. |
protected final String |
formatString
|
protected final boolean |
showMantissa
|
protected |
ExpFormatter (int base, String mantissaFmt, String mulSign, String baseExpFmt)
|
String |
format (Double x)
Formats value x according to the formatter rules. |
| Show all inherited methods (11 more) | |
static ExpFormatter |
plainExp (int base)
Plain text format as an integer power of a specific base written as "B^X",
where B is the base and X is the power (exponent). |
static ExpFormatter |
plainExp (int base, String mantissaFmt)
Plain text format as mantissa and exponent in a specific base written as "M*B^X",
where M is mantissa, B is the base, and X is the power (exponent). |
static NumberFormatter |
simple (String fmt)
Inherited from NumberFormatter. |
static ExpFormatter |
svgExp (int base, double dy)
SVG-compatible format as an integer power of a specific base written in superscript form using <tspan> tag. |
static ExpFormatter |
svgExp (int base, String mantissaFmt, double dy)
SVG-compatible format as mantissa and exponent in a specific base written in superscript form using <tspan> tag. |
protected ExpFormatter ( int base, String mantissaFmt, String mulSign, String baseExpFmt );
@Override public String format ( Double x );
Implements ValueFormatter.format(T). Copied description:
Formats value x according to the formatter rules.
xformatted string
public static ExpFormatter plainExp ( int base );
Plain text format as an integer power of a specific base written as "B^X",
where B is the base and X is the power (exponent).
Note that the number is rounded to the nearest integer power of base.
If you need precise expression, use mantissa version instead.
base2^X, 2 is the basenumber formatter object encapsulating the rule
public static ExpFormatter plainExp ( int base, String mantissaFmt );
Plain text format as mantissa and exponent in a specific base written as "M*B^X",
where M is mantissa, B is the base, and X is the power (exponent).
base2^X, 2 is the basemantissaFmtsimple number format.
Format string should expect mantissa to be a floating point number. Valid examples are:
"%f", "%.1f", "%+.3f", and so on. Using "%e" is not recommended
as it would not make sense in the final result.
number formatter object encapsulating the rule
public static ExpFormatter svgExp ( int base, double dy );
SVG-compatible format as an integer power of a specific base written in superscript form using <tspan> tag.
The exact format is:
B<tspan dy="dy" style="font-size:smaller">X</tspan>
where B is the base and X is the power (exponent); dy is the superscript offset.
The formatted string can be used within SVG tag <text> and should appear as:
BX
Note that the number is rounded to the nearest integer power of base.
If you need precise expression, use mantissa version of instead.
basedynumber formatter object encapsulating the rule
public static ExpFormatter svgExp ( int base, String mantissaFmt, double dy );
SVG-compatible format as mantissa and exponent in a specific base written in superscript form using <tspan> tag.
The exact format is:
M·B<tspan dy="dy" style="font-size:smaller">X</tspan>
where M is mantissa, B is the base, and X is the power (exponent); dy is the superscript offset.
The formatted string can be used within SVG tag <text> and should appear as:
M·BX
basemantissaFmtsimple number format.
Format string should expect mantissa to be a floating point number. Valid examples are:
"%f", "%.1f", "%+.3f", and so on. Using "%e" is not recommended
as it would not make sense in the final result.
dynumber formatter object encapsulating the rule