Package com.ibm.icu.impl
Class DateNumberFormat
java.lang.Object
java.text.Format
com.ibm.icu.text.UFormat
com.ibm.icu.text.NumberFormat
com.ibm.icu.impl.DateNumberFormat
- All Implemented Interfaces:
Serializable
,Cloneable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.ibm.icu.text.NumberFormat
NumberFormat.Field, NumberFormat.NumberFormatFactory, NumberFormat.SimpleNumberFormatFactory
Nested classes/interfaces inherited from class com.ibm.icu.text.UFormat
UFormat.SpanField
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static SimpleCache
<ULocale, char[]> private static final int
private char[]
private char[]
private int
private int
private char
private static final long
private boolean
private static final long
private char
Fields inherited from class com.ibm.icu.text.NumberFormat
ACCOUNTINGCURRENCYSTYLE, CASHCURRENCYSTYLE, CURRENCYSTYLE, FRACTION_FIELD, INTEGER_FIELD, INTEGERSTYLE, ISOCURRENCYSTYLE, NUMBERSTYLE, PERCENTSTYLE, PLURALCURRENCYSTYLE, SCIENTIFICSTYLE, STANDARDCURRENCYSTYLE
-
Constructor Summary
ConstructorsConstructorDescriptionDateNumberFormat
(ULocale loc, char zeroDigit, String nsName) DateNumberFormat
(ULocale loc, String digitString, String nsName) -
Method Summary
Modifier and TypeMethodDescriptionclone()
Overrides clone.boolean
Overrides equals.format
(double number, StringBuffer toAppendTo, FieldPosition pos) Specialization of format.format
(long numberL, StringBuffer toAppendTo, FieldPosition pos) Specialization of format.format
(BigDecimal number, StringBuffer toAppendTo, FieldPosition pos) Formats an ICU BigDecimal.format
(BigDecimal number, StringBuffer toAppendTo, FieldPosition pos) Formats a BigDecimal.format
(BigInteger number, StringBuffer toAppendTo, FieldPosition pos) Formats a BigInteger.char[]
int
Returns the maximum number of digits allowed in the integer portion of a number.int
Returns the minimum number of digits allowed in the integer portion of a number.char
int
hashCode()
private void
initialize
(ULocale loc, String digitString, String nsName) parse
(String text, ParsePosition parsePosition) Returns a Long if possible (e.g., within the range [Long.MIN_VALUE, Long.MAX_VALUE] and with no decimals); otherwise, returns another type, such as a BigDecimal, BigInteger, or Double.private void
readObject
(ObjectInputStream stream) void
setMaximumIntegerDigits
(int newValue) Sets the maximum number of digits allowed in the integer portion of a number.void
setMinimumIntegerDigits
(int newValue) Sets the minimum number of digits allowed in the integer portion of a number.void
setParsePositiveOnly
(boolean isPositiveOnly) void
setZeroDigit
(char zero) Methods inherited from class com.ibm.icu.text.NumberFormat
format, format, format, format, format, format, format, format, getAvailableLocales, getAvailableULocales, getContext, getCurrency, getCurrencyInstance, getCurrencyInstance, getCurrencyInstance, getEffectiveCurrency, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMinimumFractionDigits, getNumberInstance, getNumberInstance, getNumberInstance, getPattern, getPattern, getPatternForStyle, getPatternForStyleAndNumberingSystem, getPercentInstance, getPercentInstance, getPercentInstance, getRoundingMode, getScientificInstance, getScientificInstance, getScientificInstance, isGroupingUsed, isParseIntegerOnly, isParseStrict, parse, parseCurrency, parseObject, registerFactory, setContext, setCurrency, setGroupingUsed, setMaximumFractionDigits, setMinimumFractionDigits, setParseIntegerOnly, setParseStrict, setRoundingMode, unregister
Methods inherited from class java.text.Format
format, formatToCharacterIterator, parseObject
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
digits
private char[] digits -
zeroDigit
private char zeroDigit -
minusSign
private char minusSign -
positiveOnly
private boolean positiveOnly -
DECIMAL_BUF_SIZE
private static final int DECIMAL_BUF_SIZE- See Also:
-
decimalBuf
private transient char[] decimalBuf -
CACHE
-
maxIntDigits
private int maxIntDigits -
minIntDigits
private int minIntDigits -
PARSE_THRESHOLD
private static final long PARSE_THRESHOLD- See Also:
-
-
Constructor Details
-
DateNumberFormat
-
DateNumberFormat
-
-
Method Details
-
initialize
-
setMaximumIntegerDigits
public void setMaximumIntegerDigits(int newValue) Description copied from class:NumberFormat
Sets the maximum number of digits allowed in the integer portion of a number. This must be >= minimumIntegerDigits. If the new value for maximumIntegerDigits is less than the current value of minimumIntegerDigits, then minimumIntegerDigits will also be set to the new value.- Overrides:
setMaximumIntegerDigits
in classNumberFormat
- Parameters:
newValue
- the maximum number of integer digits to be shown; if less than zero, then zero is used. Subclasses might enforce an upper limit to this value appropriate to the numeric type being formatted.- See Also:
-
getMaximumIntegerDigits
public int getMaximumIntegerDigits()Description copied from class:NumberFormat
Returns the maximum number of digits allowed in the integer portion of a number. The default value is 40, which subclasses can override. When formatting, if the number of digits exceeds this value, the highest- significance digits are truncated until the limit is reached, in accordance with UTS#35. This setting has no effect on parsing.- Overrides:
getMaximumIntegerDigits
in classNumberFormat
- Returns:
- the maximum number of integer digits
- See Also:
-
setMinimumIntegerDigits
public void setMinimumIntegerDigits(int newValue) Description copied from class:NumberFormat
Sets the minimum number of digits allowed in the integer portion of a number. This must be <= maximumIntegerDigits. If the new value for minimumIntegerDigits is more than the current value of maximumIntegerDigits, then maximumIntegerDigits will also be set to the new value.- Overrides:
setMinimumIntegerDigits
in classNumberFormat
- Parameters:
newValue
- the minimum number of integer digits to be shown; if less than zero, then zero is used. Subclasses might enforce an upper limit to this value appropriate to the numeric type being formatted.- See Also:
-
getMinimumIntegerDigits
public int getMinimumIntegerDigits()Description copied from class:NumberFormat
Returns the minimum number of digits allowed in the integer portion of a number. The default value is 1, which subclasses can override. When formatting, if this value is not reached, numbers are padded on the left with the locale-specific '0' character to ensure at least this number of integer digits. When parsing, this has no effect.- Overrides:
getMinimumIntegerDigits
in classNumberFormat
- Returns:
- the minimum number of integer digits
- See Also:
-
setParsePositiveOnly
public void setParsePositiveOnly(boolean isPositiveOnly) -
getZeroDigit
public char getZeroDigit() -
setZeroDigit
public void setZeroDigit(char zero) -
getDigits
public char[] getDigits() -
format
Description copied from class:NumberFormat
Specialization of format.- Specified by:
format
in classNumberFormat
- See Also:
-
format
Description copied from class:NumberFormat
Specialization of format.- Specified by:
format
in classNumberFormat
- See Also:
-
format
Description copied from class:NumberFormat
Formats a BigInteger. Specialization of format.- Specified by:
format
in classNumberFormat
- See Also:
-
format
Description copied from class:NumberFormat
Formats a BigDecimal. Specialization of format.- Specified by:
format
in classNumberFormat
- See Also:
-
format
Description copied from class:NumberFormat
Formats an ICU BigDecimal. Specialization of format.- Specified by:
format
in classNumberFormat
- See Also:
-
parse
Description copied from class:NumberFormat
Returns a Long if possible (e.g., within the range [Long.MIN_VALUE, Long.MAX_VALUE] and with no decimals); otherwise, returns another type, such as a BigDecimal, BigInteger, or Double. The return type is not guaranteed other than for the Long case.If IntegerOnly is set, will stop at a decimal point (or equivalent; e.g., for rational numbers "1 2/3", will stop after the 1).
Does not throw an exception; if no object can be parsed, index is unchanged!
For more detail on parsing, see the "Parsing" header in the class documentation of
DecimalFormat
.- Specified by:
parse
in classNumberFormat
- See Also:
-
equals
Description copied from class:NumberFormat
Overrides equals. Two NumberFormats are equal they are of the same class and the user-specified values for settings (groupingUsed, parseIntegerOnly, maximumIntegerDigits, etc.) are equal.- Overrides:
equals
in classNumberFormat
- Parameters:
obj
- the object to compare against- Returns:
- true if the object is equal to this.
-
hashCode
public int hashCode()Description copied from class:NumberFormat
- Overrides:
hashCode
in classNumberFormat
-
readObject
- Throws:
IOException
ClassNotFoundException
-
clone
Description copied from class:NumberFormat
Overrides clone.- Overrides:
clone
in classNumberFormat
-