java.lang.Object
io.sf.jclf.text.format.ObjectFormat
io.sf.jclf.text.format.NumberFormat
io.sf.jclf.text.format.FloatFormat
- All Implemented Interfaces:
Alignable
- Direct Known Subclasses:
ExponentFormat
-
Field Summary
Fields inherited from class io.sf.jclf.text.format.NumberFormat
blankpre, signpre, tipo, zeropadding
Fields inherited from class io.sf.jclf.text.format.ObjectFormat
flags, precision, ralign, width
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic FloatFormat
create
(String format, DecimalFormatSymbols symbols) Creates the proper FloatFormat object according to format.static FloatFormat
Creates the proper FloatFormat object according to format.Formats an object according to the format specification set bysetFormat
.Gets the decimal format symbols.sample()
Produce a sample of this format.void
Sets the decimal format symbols.protected boolean
setFlag
(char flag, int i) Sets the flags specific to this Class.toString()
Methods inherited from class io.sf.jclf.text.format.NumberFormat
getRoundingFactor, roundNumber, setFormat
Methods inherited from class io.sf.jclf.text.format.ObjectFormat
align, create, create, create, expandLeftToWidth, expandRightToWidth, getAlignment, rightAppend, setFlags
-
Field Details
-
numpre
protected boolean numpre
-
-
Constructor Details
-
FloatFormat
public FloatFormat()
-
-
Method Details
-
create
Creates the proper FloatFormat object according to format.- Parameters:
format
- the formatlocale
- the locale for symbols.- Returns:
- the FloatFormat object for
format
- Throws:
SpecParsingException
- if the format is not known.
-
create
public static FloatFormat create(String format, DecimalFormatSymbols symbols) throws SpecParsingException Creates the proper FloatFormat object according to format.- Parameters:
format
- the formatsymbols
- the symbols to use in decimal formatting.- Returns:
- the FloatFormat object for
format
- Throws:
SpecParsingException
- if the format is not known.
-
setFlag
protected boolean setFlag(char flag, int i) Description copied from class:ObjectFormat
Sets the flags specific to this Class.- Overrides:
setFlag
in classNumberFormat
- Parameters:
flag
- the flagi
- the position of the flag in the flags String- Returns:
true
if the flag was understood,false
otherwise.
-
format
Description copied from class:ObjectFormat
Formats an object according to the format specification set bysetFormat
.Must be overriden by subclasses.
- Specified by:
format
in classObjectFormat
- Parameters:
o
- the object to be formatted.- Returns:
- a string with the formatted object.
-
setDecimalFormatSymbols
Sets the decimal format symbols. The symbols are generally locale-dependent.- Parameters:
symbols
- the new DecimalFormatSymbols
-
getDecimalFormatSymbols
Gets the decimal format symbols.- Returns:
- the DecimalFormatSymbols
-
toString
-
sample
Description copied from class:ObjectFormat
Produce a sample of this format.- Specified by:
sample
in classObjectFormat
- Returns:
- a String with a (more or less) random object appropriate to be formatted according to current format specifications.
-