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
FieldsFields inherited from class io.sf.jclf.text.format.NumberFormat
blankpre, signpre, tipo, zeropaddingFields inherited from class io.sf.jclf.text.format.ObjectFormat
flags, precision, ralign, width -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FloatFormatcreate(String format, DecimalFormatSymbols symbols) Creates the proper FloatFormat object according to format.static FloatFormatCreates 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.voidSets the decimal format symbols.protected booleansetFlag(char flag, int i) Sets the flags specific to this Class.toString()Methods inherited from class io.sf.jclf.text.format.NumberFormat
getRoundingFactor, roundNumber, setFormatMethods 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:ObjectFormatSets the flags specific to this Class.- Overrides:
setFlagin classNumberFormat- Parameters:
flag- the flagi- the position of the flag in the flags String- Returns:
trueif the flag was understood,falseotherwise.
-
format
Description copied from class:ObjectFormatFormats an object according to the format specification set bysetFormat.Must be overriden by subclasses.
- Specified by:
formatin 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:ObjectFormatProduce a sample of this format.- Specified by:
samplein classObjectFormat- Returns:
- a String with a (more or less) random object appropriate to be formatted according to current format specifications.
-