Package mondrian.util
Class Format.BasicFormat
- java.lang.Object
-
- mondrian.util.Format.BasicFormat
-
- Direct Known Subclasses:
Format.AlternateFormat,Format.CompoundFormat,Format.FallbackFormat,Format.JavaFormat,Format.LiteralFormat
- Enclosing class:
- Format
static class Format.BasicFormat extends Object
BasicFormat is the interface implemented by the classes which do all the work. WhereasFormathas only one method for formatting,Format.format(Object), this class provides methods for several primitive types. To make it easy to combine formatting objects, all methods write to aPrintWriter.The base implementation of most of these methods throws; there is no requirement that a derived class implements all of these methods. It is up to
Format.parseFormatString(java.lang.String, java.util.List<mondrian.util.Format.BasicFormat>, mondrian.util.Format.FormatType[])to ensure that, for example, theformat(double,StringBuilder)method is never called forFormat.DateFormat.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) intcode
-
Constructor Summary
Constructors Constructor Description BasicFormat()BasicFormat(int code)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidformat(double d, StringBuilder buf)(package private) voidformat(long n, StringBuilder buf)(package private) voidformat(String s, StringBuilder buf)(package private) voidformat(Calendar calendar, StringBuilder buf)(package private) voidformat(Date date, StringBuilder buf)(package private) voidformatNull(StringBuilder buf)(package private) mondrian.util.Format.FormatTypegetFormatType()(package private) booleanisApplicableTo(double n)Returns whether this format can handle a given value.(package private) booleanisApplicableTo(long n)Returns whether this format can handle a given value.
-
-
-
Method Detail
-
getFormatType
mondrian.util.Format.FormatType getFormatType()
-
formatNull
void formatNull(StringBuilder buf)
-
format
void format(double d, StringBuilder buf)
-
format
void format(long n, StringBuilder buf)
-
format
void format(String s, StringBuilder buf)
-
format
void format(Date date, StringBuilder buf)
-
format
void format(Calendar calendar, StringBuilder buf)
-
isApplicableTo
boolean isApplicableTo(double n)
Returns whether this format can handle a given value.Usually returns true; one notable exception is a format for negative numbers which causes the number to be underflow to zero and therefore be ineligible for the negative format.
- Parameters:
n- value- Returns:
- Whether this format is applicable for a given value
-
isApplicableTo
boolean isApplicableTo(long n)
Returns whether this format can handle a given value.Usually returns true; one notable exception is a format for negative numbers which causes the number to be underflow to zero and therefore be ineligible for the negative format.
- Parameters:
n- value- Returns:
- Whether this format is applicable for a given value
-
-