ICU-1285 doc changes to numberformat and decimal format (icu4j)
X-SVN-Rev: 12360
This commit is contained in:
parent
0bb36b9f5c
commit
781b158132
@ -5,8 +5,8 @@
|
||||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/DecimalFormat.java,v $
|
||||
* $Date: 2003/06/05 23:05:17 $
|
||||
* $Revision: 1.34 $
|
||||
* $Date: 2003/06/06 21:09:43 $
|
||||
* $Revision: 1.35 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
@ -53,17 +53,9 @@ import java.io.ObjectInputStream;
|
||||
* }
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* <p>A <code>DecimalFormat</code> comprises a <em>pattern</em> and a set of
|
||||
* <em>symbols</em>. The pattern may be set directly using
|
||||
* <code>applyPattern()</code>, or indirectly using the API methods. The
|
||||
* symbols are stored in a <code>DecimalFormatSymbols</code> object. When using
|
||||
* the <code>NumberFormat</code> factory methods, the pattern and symbols are
|
||||
* read from localized <code>ResourceBundle</code>s in the package
|
||||
* <code>java.text.resource</code>.
|
||||
*
|
||||
* <h4>Synchronization</h4>
|
||||
* <p>
|
||||
* Decimal formats are generally not synchronized. It is recommended to create
|
||||
* Decimal formats are not synchronized. It is recommended that you create
|
||||
* separate format instances for each thread. If multiple threads access a format
|
||||
* concurrently, it must be synchronized externally.
|
||||
* <p>
|
||||
@ -75,7 +67,7 @@ import java.io.ObjectInputStream;
|
||||
* // and percent format for each locale</strong>
|
||||
* Locale[] locales = NumberFormat.getAvailableLocales();
|
||||
* double myNumber = -1234.56;
|
||||
* NumberFormat form;
|
||||
* NumberFormat format;
|
||||
* for (int j=0; j<3; ++j) {
|
||||
* System.out.println("FORMAT");
|
||||
* for (int i = 0; i < locales.length; ++i) {
|
||||
@ -86,19 +78,19 @@ import java.io.ObjectInputStream;
|
||||
* System.out.print(locales[i].getDisplayName());
|
||||
* switch (j) {
|
||||
* case 0:
|
||||
* form = NumberFormat.getInstance(locales[i]); break;
|
||||
* format = NumberFormat.getInstance(locales[i]); break;
|
||||
* case 1:
|
||||
* form = NumberFormat.getCurrencyInstance(locales[i]); break;
|
||||
* format = NumberFormat.getCurrencyInstance(locales[i]); break;
|
||||
* default:
|
||||
* form = NumberFormat.getPercentInstance(locales[i]); break;
|
||||
* format = NumberFormat.getPercentInstance(locales[i]); break;
|
||||
* }
|
||||
* try {
|
||||
* // Assume form is a DecimalFormat
|
||||
* System.out.print(": " + ((DecimalFormat) form).toPattern()
|
||||
* // Assume format is a DecimalFormat
|
||||
* System.out.print(": " + ((DecimalFormat) format).toPattern()
|
||||
* + " -> " + form.format(myNumber));
|
||||
* } catch (IllegalArgumentException e) {}
|
||||
* try {
|
||||
* System.out.println(" -> " + form.parse(form.format(myNumber)));
|
||||
* System.out.println(" -> " + format.parse(form.format(myNumber)));
|
||||
* } catch (ParseException e) {}
|
||||
* }
|
||||
* }
|
||||
@ -106,6 +98,106 @@ import java.io.ObjectInputStream;
|
||||
*
|
||||
* <p><strong>Notes</strong>
|
||||
*
|
||||
* <h4>Patterns</h4>
|
||||
*
|
||||
* <p>A <code>DecimalFormat</code> consists of a <em>pattern</em> and a set of
|
||||
* <em>symbols</em>. The pattern may be set directly using
|
||||
* <code>applyPattern()</code>, or indirectly using the API methods. The
|
||||
* symbols are stored in a <code>DecimalFormatSymbols</code> object. When using
|
||||
* the <code>NumberFormat</code> factory methods, the pattern and symbols are
|
||||
* read from localized <code>ResourceBundle</code>s provided by ICU.
|
||||
*
|
||||
* <table bgcolor="#ccccff" border="0" cellspacing="3" cellpadding="3" summary="Example patterns">
|
||||
*
|
||||
* </table>
|
||||
*
|
||||
* <h4>Special Pattern Characters</h4>
|
||||
*
|
||||
* <p>Many characters in a pattern are taken literally; they are matched during
|
||||
* parsing and output unchanged during formatting. Special characters, on the
|
||||
* other hand, stand for other characters, strings, or classes of characters.
|
||||
* They must be quoted, unless noted otherwise, if they are to appear in the
|
||||
* prefix or suffix as literals.
|
||||
*
|
||||
* <p>The characters listed here are used in non-localized patterns. Localized
|
||||
* patterns use the corresponding characters taken from this formatter's
|
||||
* <code>DecimalFormatSymbols</code> object instead, and these characters lose
|
||||
* their special status. Two exceptions are the currency sign and quote, which
|
||||
* are not localized.
|
||||
*
|
||||
* <blockquote>
|
||||
* <table border=0 cellspacing=3 cellpadding=0 summary="Chart showing symbol,
|
||||
* location, localized, and meaning.">
|
||||
* <tr bgcolor="#ccccff">
|
||||
* <th align=left>Symbol
|
||||
* <th align=left>Location
|
||||
* <th align=left>Localized?
|
||||
* <th align=left>Meaning
|
||||
* <tr valign=top>
|
||||
* <td><code>0</code>
|
||||
* <td>Number
|
||||
* <td>Yes
|
||||
* <td>Digit
|
||||
* <tr valign=top bgcolor="#eeeeff">
|
||||
* <td><code>#</code>
|
||||
* <td>Number
|
||||
* <td>Yes
|
||||
* <td>Digit, zero shows as absent
|
||||
* <tr valign=top>
|
||||
* <td><code>.</code>
|
||||
* <td>Number
|
||||
* <td>Yes
|
||||
* <td>Decimal separator or monetary decimal separator
|
||||
* <tr valign=top bgcolor="#eeeeff">
|
||||
* <td><code>-</code>
|
||||
* <td>Number
|
||||
* <td>Yes
|
||||
* <td>Minus sign
|
||||
* <tr valign=top>
|
||||
* <td><code>,</code>
|
||||
* <td>Number
|
||||
* <td>Yes
|
||||
* <td>Grouping separator
|
||||
* <tr valign=top bgcolor="#eeeeff">
|
||||
* <td><code>E</code>
|
||||
* <td>Number
|
||||
* <td>Yes
|
||||
* <td>Separates mantissa and exponent in scientific notation.
|
||||
* <em>Need not be quoted in prefix or suffix.</em>
|
||||
* <tr valign=top>
|
||||
* <td><code>;</code>
|
||||
* <td>Subpattern boundary
|
||||
* <td>Yes
|
||||
* <td>Separates positive and negative subpatterns
|
||||
* <tr valign=top bgcolor="#eeeeff">
|
||||
* <td><code>%</code>
|
||||
* <td>Prefix or suffix
|
||||
* <td>Yes
|
||||
* <td>Multiply by 100 and show as percentage
|
||||
* <tr valign=top>
|
||||
* <td><code>\u2030</code>
|
||||
* <td>Prefix or suffix
|
||||
* <td>Yes
|
||||
* <td>Multiply by 1000 and show as per mille
|
||||
* <tr valign=top bgcolor="#eeeeff">
|
||||
* <td><code>¤</code> (<code>\u00A4</code>)
|
||||
* <td>Prefix or suffix
|
||||
* <td>No
|
||||
* <td>Currency sign, replaced by currency symbol. If
|
||||
* doubled, replaced by international currency symbol.
|
||||
* If present in a pattern, the monetary decimal separator
|
||||
* is used instead of the decimal separator.
|
||||
* <tr valign=top>
|
||||
* <td><code>'</code>
|
||||
* <td>Prefix or suffix
|
||||
* <td>No
|
||||
* <td>Used to quote special characters in a prefix or suffix,
|
||||
* for example, <code>"'#'#"</code> formats 123 to
|
||||
* <code>"#123"</code>. To create a single quote
|
||||
* itself, use two in a row: <code>"# o''clock"</code>.
|
||||
* </table>
|
||||
* </blockquote>
|
||||
*
|
||||
* <p>A <code>DecimalFormat</code> pattern contains a postive and negative
|
||||
* subpattern, for example, "#,##0.00;(#,##0.00)". Each subpattern has a
|
||||
* prefix, numeric part, and suffix. If there is no explicit negative
|
||||
@ -172,7 +264,6 @@ import java.io.ObjectInputStream;
|
||||
* <code>DecimalFormatSymbols</code> object.
|
||||
*
|
||||
* <p>
|
||||
* <strong><font face=helvetica color=red>NEW</font></strong>
|
||||
* <strong>Scientific Notation</strong>
|
||||
*
|
||||
* <p>Numbers in scientific notation are expressed as the product of a mantissa
|
||||
@ -234,7 +325,7 @@ import java.io.ObjectInputStream;
|
||||
*
|
||||
* <li>Some parameters which usually do not matter have meaning when padding is
|
||||
* used, because the pattern width is significant with padding. In the pattern
|
||||
* "^ ##,##,#,##0.##", the format width is 14. The initial characters "##,##,"
|
||||
* "* ##,##,#,##0.##", the format width is 14. The initial characters "##,##,"
|
||||
* do not affect the grouping size or maximum integer digits, but they do affect
|
||||
* the format width.
|
||||
*
|
||||
@ -446,7 +537,7 @@ public class DecimalFormat extends NumberFormat {
|
||||
* @see DecimalFormatSymbols
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public DecimalFormat (String pattern, DecimalFormatSymbols symbols) {
|
||||
public DecimalFormat(String pattern, DecimalFormatSymbols symbols) {
|
||||
// Always applyPattern after the symbols are set
|
||||
this.symbols = (DecimalFormatSymbols) symbols.clone();
|
||||
setCurrencyForSymbols();
|
||||
@ -1665,8 +1756,7 @@ public class DecimalFormat extends NumberFormat {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the decimal format symbols, which is generally not changed
|
||||
* by the programmer or user.
|
||||
* Returns a copy of the decimal format symbols used by this format.
|
||||
* @return desired DecimalFormatSymbols
|
||||
* @see DecimalFormatSymbols
|
||||
* @stable ICU 2.0
|
||||
@ -1682,8 +1772,8 @@ public class DecimalFormat extends NumberFormat {
|
||||
|
||||
|
||||
/**
|
||||
* Sets the decimal format symbols, which is generally not changed
|
||||
* by the programmer or user.
|
||||
* Sets the decimal format symbols used by this format. The
|
||||
* format uses a copy of the provided symbols.
|
||||
* @param newSymbols desired DecimalFormatSymbols
|
||||
* @see DecimalFormatSymbols
|
||||
* @stable ICU 2.0
|
||||
@ -2229,6 +2319,14 @@ public class DecimalFormat extends NumberFormat {
|
||||
/**
|
||||
* Allows you to set the behavior of the decimal separator with integers.
|
||||
* (The decimal separator will always appear with decimals.)
|
||||
*
|
||||
* <p>This only affects formatting, and only where
|
||||
* there might be no digits after the decimal point, e.g.,
|
||||
* if true, 3456.00 -> "3,456."
|
||||
* if false, 3456.00 -> "3456"
|
||||
* This is independent of parsing. If you want parsing to stop at the decimal
|
||||
* point, use setParseIntegerOnly.
|
||||
*
|
||||
* <P>Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
@ -2500,7 +2598,7 @@ public class DecimalFormat extends NumberFormat {
|
||||
}
|
||||
StringBuffer affixBuf = new StringBuffer();
|
||||
expandAffix(affixPat, affixBuf, true);
|
||||
buf.append(affixBuf);
|
||||
buf.append(affixBuf.toString());
|
||||
return affixBuf.length();
|
||||
}
|
||||
|
||||
@ -2510,7 +2608,7 @@ public class DecimalFormat extends NumberFormat {
|
||||
} else {
|
||||
affix = isNegative ? negativeSuffix : positiveSuffix;
|
||||
}
|
||||
buf.append(affix.toString());
|
||||
buf.append(affix);
|
||||
return affix.length();
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/NumberFormat.java,v $
|
||||
* $Date: 2003/06/03 18:49:34 $
|
||||
* $Revision: 1.28 $
|
||||
* $Date: 2003/06/06 21:09:43 $
|
||||
* $Revision: 1.29 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
@ -100,25 +100,16 @@ import com.ibm.icu.impl.LocaleUtility;
|
||||
* encounter an unusual one.
|
||||
*
|
||||
* <p>
|
||||
* NumberFormat and DecimalFormat are designed such that some controls
|
||||
* NumberFormat is designed such that some controls
|
||||
* work for formatting and others work for parsing. The following is
|
||||
* the detailed description for each these control methods,
|
||||
* <p>
|
||||
* setParseIntegerOnly : only affects parsing, e.g.
|
||||
* if true, "3456.78" -> 3456 (and leaves the parse position just after index 6)
|
||||
* if false, "3456.78" -> 3456.78 (and leaves the parse position just after index 8)
|
||||
* if true, "3456.78" -> 3456 (and leaves the parse position just after '6')
|
||||
* if false, "3456.78" -> 3456.78 (and leaves the parse position just after '8')
|
||||
* This is independent of formatting. If you want to not show a decimal point
|
||||
* where there might be no digits after the decimal point, use
|
||||
* setDecimalSeparatorAlwaysShown.
|
||||
* <p>
|
||||
* setDecimalSeparatorAlwaysShown : only affects formatting, and only where
|
||||
* there might be no digits after the decimal point, such as with a pattern
|
||||
* like "#,##0.##", e.g.,
|
||||
* if true, 3456.00 -> "3,456."
|
||||
* if false, 3456.00 -> "3456"
|
||||
* This is independent of parsing. If you want parsing to stop at the decimal
|
||||
* point, use setParseIntegerOnly.
|
||||
*
|
||||
* setDecimalSeparatorAlwaysShown on DecimalFormat.
|
||||
* <p>
|
||||
* You can also use forms of the <code>parse</code> and <code>format</code>
|
||||
* methods with <code>ParsePosition</code> and <code>FieldPosition</code> to
|
||||
@ -153,6 +144,11 @@ import com.ibm.icu.impl.LocaleUtility;
|
||||
* concurrently, it must be synchronized externally.
|
||||
* <p>
|
||||
*
|
||||
* <h4>DecimalFormat</h4>
|
||||
* <p>DecimalFormat is the concrete implementation of NumberFormat, and the
|
||||
* NumberFormat API is essentially an abstraction from DecimalFormat's API.
|
||||
* Refer to DecimalFormat for more information about this API.</p>
|
||||
*
|
||||
* see DecimalFormat
|
||||
* see java.text.ChoiceFormat
|
||||
* @author Mark Davis
|
||||
@ -160,7 +156,7 @@ import com.ibm.icu.impl.LocaleUtility;
|
||||
* @author Alan Liu
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public abstract class NumberFormat extends Format{
|
||||
public abstract class NumberFormat extends Format {
|
||||
|
||||
// Constants used by factory methods to specify a style of format.
|
||||
private static final int NUMBERSTYLE = 0;
|
||||
@ -188,7 +184,7 @@ public abstract class NumberFormat extends Format{
|
||||
/**
|
||||
* <strong><font face=helvetica color=red>CHANGED</font></strong>
|
||||
* Format an object. Change: recognizes <code>BigInteger</code>
|
||||
* and <code>BigDecimal</code> objects now.
|
||||
* and <code>BigDecimal</code> objects.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public final StringBuffer format(Object number,
|
||||
@ -261,7 +257,7 @@ public abstract class NumberFormat extends Format{
|
||||
|
||||
/**
|
||||
* <strong><font face=helvetica color=red>NEW</font></strong>
|
||||
* Convenience method to format a BigDecimal.
|
||||
* Convenience method to format an ICU BigDecimal.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public final String format(com.ibm.icu.math.BigDecimal number) {
|
||||
@ -333,7 +329,7 @@ public abstract class NumberFormat extends Format{
|
||||
|
||||
/**
|
||||
* Parses text from the beginning of the given string to produce a number.
|
||||
* The method may not use the entire text of the given string.
|
||||
* The method might not use the entire text of the given string.
|
||||
*
|
||||
* @param text A String whose beginning should be parsed.
|
||||
* @return A Number parsed from the string.
|
||||
@ -358,9 +354,10 @@ public abstract class NumberFormat extends Format{
|
||||
* Returns true if this format will parse numbers as integers only.
|
||||
* For example in the English locale, with ParseIntegerOnly true, the
|
||||
* string "1234." would be parsed as the integer value 1234 and parsing
|
||||
* would stop at the "." character. Of course, the exact format accepted
|
||||
* by the parse operation is locale dependant and determined by sub-classes
|
||||
* of NumberFormat.
|
||||
* would stop at the "." character. The decimal separator accepted
|
||||
* by the parse operation is locale-dependent and determined by the
|
||||
* subclass.
|
||||
* @return true if this will parse integers only
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public boolean isParseIntegerOnly() {
|
||||
@ -369,6 +366,7 @@ public abstract class NumberFormat extends Format{
|
||||
|
||||
/**
|
||||
* Sets whether or not numbers should be parsed as integers only.
|
||||
* @param value true if this should parse integers only
|
||||
* @see #isParseIntegerOnly
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
@ -383,7 +381,7 @@ public abstract class NumberFormat extends Format{
|
||||
* The default format is one of the styles provided by the other
|
||||
* factory methods: getNumberInstance, getIntegerInstance,
|
||||
* getCurrencyInstance or getPercentInstance.
|
||||
* Exactly which one is locale dependant.
|
||||
* Exactly which one is locale-dependent.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
//Bug 4408066 [Richard/GCL]
|
||||
@ -395,7 +393,7 @@ public abstract class NumberFormat extends Format{
|
||||
* Returns the default number format for the specified locale.
|
||||
* The default format is one of the styles provided by the other
|
||||
* factory methods: getNumberInstance, getCurrencyInstance or getPercentInstance.
|
||||
* Exactly which one is locale dependant.
|
||||
* Exactly which one is locale-dependent.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public static NumberFormat getInstance(Locale inLocale) {
|
||||
@ -453,6 +451,7 @@ public abstract class NumberFormat extends Format{
|
||||
|
||||
/**
|
||||
* Returns a currency format for the current default locale.
|
||||
* @return a number format for currency
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public final static NumberFormat getCurrencyInstance() {
|
||||
@ -461,6 +460,7 @@ public abstract class NumberFormat extends Format{
|
||||
|
||||
/**
|
||||
* Returns a currency format for the specified locale.
|
||||
* @return a number format for currency
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public static NumberFormat getCurrencyInstance(Locale inLocale) {
|
||||
@ -469,6 +469,7 @@ public abstract class NumberFormat extends Format{
|
||||
|
||||
/**
|
||||
* Returns a percentage format for the current default locale.
|
||||
* @return a number format for percents
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public final static NumberFormat getPercentInstance() {
|
||||
@ -477,6 +478,7 @@ public abstract class NumberFormat extends Format{
|
||||
|
||||
/**
|
||||
* Returns a percentage format for the specified locale.
|
||||
* @return a number format for percents
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public static NumberFormat getPercentInstance(Locale inLocale) {
|
||||
@ -486,6 +488,7 @@ public abstract class NumberFormat extends Format{
|
||||
/**
|
||||
* <strong><font face=helvetica color=red>NEW</font></strong>
|
||||
* Returns a scientific format for the current default locale.
|
||||
* @return a scientific number format
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public final static NumberFormat getScientificInstance() {
|
||||
@ -495,6 +498,7 @@ public abstract class NumberFormat extends Format{
|
||||
/**
|
||||
* <strong><font face=helvetica color=red>NEW</font></strong>
|
||||
* Returns a scientific format for the specified locale.
|
||||
* @return a scientific number format
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public static NumberFormat getScientificInstance(Locale inLocale) {
|
||||
@ -506,7 +510,7 @@ public abstract class NumberFormat extends Format{
|
||||
* A NumberFormatFactory is used to register new number formats. The factory
|
||||
* should be able to create any of the predefined formats for each locale it
|
||||
* supports. When registered, the locales it supports extend or override the
|
||||
* locale already supported by ICU.
|
||||
* locales already supported by ICU.
|
||||
*
|
||||
* @draft ICU 2.6
|
||||
*/
|
||||
@ -542,27 +546,28 @@ public abstract class NumberFormat extends Format{
|
||||
public static final int FORMAT_INTEGER = INTEGERSTYLE;
|
||||
|
||||
/**
|
||||
* Return true if this factory is visible. Default is true.
|
||||
* Returns true if this factory is visible. Default is true.
|
||||
* If not visible, the locales supported by this factory will not
|
||||
* be listed by getAvailableLocales. This value must not change.
|
||||
* @return true if the factory is visible.
|
||||
* @draft ICU 2.6
|
||||
*/
|
||||
///CLOVER:OFF
|
||||
public boolean visible() {
|
||||
return true;
|
||||
}
|
||||
///CLOVER:ON
|
||||
|
||||
/**
|
||||
* Return an unmodifiable collection of the locale names directly
|
||||
* supported by this factory. This collection must not change once
|
||||
* created.
|
||||
* Returns an immutable collection of the locale names directly
|
||||
* supported by this factory.
|
||||
* @return the supported locale names.
|
||||
* @draft ICU 2.6
|
||||
*/
|
||||
public abstract Set getSupportedLocaleNames();
|
||||
|
||||
/**
|
||||
* Return a number format of the appropriate type. If the locale
|
||||
* Returns a number format of the appropriate type. If the locale
|
||||
* is not supported, return null. If the locale is supported, but
|
||||
* the type is not provided by this service, return null. Otherwise
|
||||
* return an appropriate instance of NumberFormat.
|
||||
@ -638,16 +643,18 @@ public abstract class NumberFormat extends Format{
|
||||
shim = (NumberFormatShim)cls.newInstance();
|
||||
}
|
||||
catch (Exception e) {
|
||||
///CLOVER:OFF
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e.getMessage());
|
||||
///CLOVER:ON
|
||||
}
|
||||
}
|
||||
return shim;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the set of Locales for which NumberFormats are installed
|
||||
* @return available locales
|
||||
* Get the list of Locales for which NumberFormats are available.
|
||||
* @return the available locales
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public static Locale[] getAvailableLocales() {
|
||||
@ -658,9 +665,9 @@ public abstract class NumberFormat extends Format{
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new NumberFormatFactory. The factory is adopted by the service and
|
||||
* must not be modified. The returned object is a key that can be used to unregister this
|
||||
* factory.
|
||||
* Registers a new NumberFormatFactory. The factory is adopted by
|
||||
* the service and must not be modified. The returned object is a
|
||||
* key that can be used to unregister this factory.
|
||||
* @param factory the factory to register
|
||||
* @return a key with which to unregister the factory
|
||||
* @draft ICU 2.6
|
||||
@ -675,7 +682,7 @@ public abstract class NumberFormat extends Format{
|
||||
/**
|
||||
* Unregister the factory or instance associated with this key (obtained from
|
||||
* registerInstance or registerFactory).
|
||||
* @param registryKey a key obtained from registerInstance or registerFactory
|
||||
* @param registryKey a key obtained from registerFactory
|
||||
* @return true if the object was successfully unregistered
|
||||
* @draft ICU 2.6
|
||||
*/
|
||||
@ -703,7 +710,11 @@ public abstract class NumberFormat extends Format{
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides equals
|
||||
* Overrides equals. Two NumberFormats are equal if they are of the same class
|
||||
* and the settings (groupingUsed, parseIntegerOnly, maximumIntegerDigits, etc.
|
||||
* are equal.
|
||||
* @param obj the object to compare against
|
||||
* @return true if the object is equal to this.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
@ -722,7 +733,7 @@ public abstract class NumberFormat extends Format{
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides Cloneable
|
||||
* Overrides Cloneable.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public Object clone()
|
||||
@ -733,9 +744,11 @@ public abstract class NumberFormat extends Format{
|
||||
|
||||
/**
|
||||
* Returns true if grouping is used in this format. For example, in the
|
||||
* English locale, with grouping on, the number 1234567 might be formatted
|
||||
* en_US locale, with grouping on, the number 1234567 will be formatted
|
||||
* as "1,234,567". The grouping separator as well as the size of each group
|
||||
* is locale dependant and is determined by sub-classes of NumberFormat.
|
||||
* is locale-dependent and is determined by subclasses of NumberFormat.
|
||||
* Grouping affects both parsing and formatting.
|
||||
* @return true if grouping is used
|
||||
* @see #setGroupingUsed
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
@ -744,8 +757,10 @@ public abstract class NumberFormat extends Format{
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether or not grouping will be used in this format.
|
||||
* Sets whether or not grouping will be used in this format. Grouping
|
||||
* affects both parsing and formatting.
|
||||
* @see #isGroupingUsed
|
||||
* @param newValue true to use grouping.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setGroupingUsed(boolean newValue) {
|
||||
@ -754,7 +769,10 @@ public abstract class NumberFormat extends Format{
|
||||
|
||||
/**
|
||||
* Returns the maximum number of digits allowed in the integer portion of a
|
||||
* number.
|
||||
* number. The default value is 40, which subclasses can override.
|
||||
* When formatting, the exact behavior when this value is exceeded is
|
||||
* subclass-specific. When parsing, this has no effect.
|
||||
* @return the maximum number of integer digits
|
||||
* @see #setMaximumIntegerDigits
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
@ -764,12 +782,12 @@ public abstract class NumberFormat extends Format{
|
||||
|
||||
/**
|
||||
* Sets the maximum number of digits allowed in the integer portion of a
|
||||
* number. MaximumIntegerDigits must be >= minimumIntegerDigits. If the
|
||||
* 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.
|
||||
* @param newValue the maximum number of integer digits to be shown; if
|
||||
* less than zero, then zero is used. The concrete subclass may enforce an
|
||||
* less than zero, then zero is used. Subclasses might enforce an
|
||||
* upper limit to this value appropriate to the numeric type being formatted.
|
||||
* @see #getMaximumIntegerDigits
|
||||
* @stable ICU 2.0
|
||||
@ -782,7 +800,11 @@ public abstract class NumberFormat extends Format{
|
||||
|
||||
/**
|
||||
* Returns the minimum number of digits allowed in the integer portion of a
|
||||
* number.
|
||||
* 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.
|
||||
* @return the minimum number of integer digits
|
||||
* @see #setMinimumIntegerDigits
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
@ -792,12 +814,12 @@ public abstract class NumberFormat extends Format{
|
||||
|
||||
/**
|
||||
* Sets the minimum number of digits allowed in the integer portion of a
|
||||
* number. MinimumIntegerDigits must be <= maximumIntegerDigits. If the
|
||||
* new value for minimumIntegerDigits exceeds the current value
|
||||
* 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
|
||||
* the new value.
|
||||
* @param newValue the minimum number of integer digits to be shown; if
|
||||
* less than zero, then zero is used. The concrete subclass may enforce an
|
||||
* less than zero, then zero is used. Subclasses might enforce an
|
||||
* upper limit to this value appropriate to the numeric type being formatted.
|
||||
* @see #getMinimumIntegerDigits
|
||||
* @stable ICU 2.0
|
||||
@ -809,8 +831,12 @@ public abstract class NumberFormat extends Format{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum number of digits allowed in the fraction portion of a
|
||||
* number.
|
||||
* Returns the maximum number of digits allowed in the fraction
|
||||
* portion of a number. The default value is 3, which subclasses
|
||||
* can override. When formatting, the exact behavior when this
|
||||
* value is exceeded is subclass-specific. When parsing, this has
|
||||
* no effect.
|
||||
* @return the maximum number of fraction digits
|
||||
* @see #setMaximumFractionDigits
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
@ -820,7 +846,7 @@ public abstract class NumberFormat extends Format{
|
||||
|
||||
/**
|
||||
* Sets the maximum number of digits allowed in the fraction portion of a
|
||||
* number. MaximumFractionDigits must be >= minimumFractionDigits. If the
|
||||
* number. This must be >= minimumFractionDigits. If the
|
||||
* new value for maximumFractionDigits is less than the current value
|
||||
* of minimumFractionDigits, then minimumFractionDigits will also be set to
|
||||
* the new value.
|
||||
@ -838,7 +864,11 @@ public abstract class NumberFormat extends Format{
|
||||
|
||||
/**
|
||||
* Returns the minimum number of digits allowed in the fraction portion of a
|
||||
* number.
|
||||
* number. The default value is 0, which subclasses can override.
|
||||
* When formatting, if this value is not reached, numbers are padded on
|
||||
* the right with the locale-specific '0' character to ensure at least
|
||||
* this number of fraction digits. When parsing, this has no effect.
|
||||
* @return the minimum number of fraction digits
|
||||
* @see #setMinimumFractionDigits
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
@ -848,12 +878,12 @@ public abstract class NumberFormat extends Format{
|
||||
|
||||
/**
|
||||
* Sets the minimum number of digits allowed in the fraction portion of a
|
||||
* number. MinimumFractionDigits must be <= maximumFractionDigits. If the
|
||||
* number. This must be <= maximumFractionDigits. If the
|
||||
* new value for minimumFractionDigits exceeds the current value
|
||||
* of maximumFractionDigits, then maximumIntegerDigits will also be set to
|
||||
* of maximumFractionDigits, then maximumFractionDigits will also be set to
|
||||
* the new value.
|
||||
* @param newValue the minimum number of fraction digits to be shown; if
|
||||
* less than zero, then zero is used. The concrete subclass may enforce an
|
||||
* less than zero, then zero is used. Subclasses might enforce an
|
||||
* upper limit to this value appropriate to the numeric type being formatted.
|
||||
* @see #getMinimumFractionDigits
|
||||
* @stable ICU 2.0
|
||||
@ -918,7 +948,7 @@ public abstract class NumberFormat extends Format{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the pattern for the provided locale and choice.
|
||||
* Returns the pattern for the provided locale and choice.
|
||||
* @param forLocale the locale of the data.
|
||||
* @param choice the pattern format.
|
||||
* @return the pattern
|
||||
@ -996,7 +1026,6 @@ public abstract class NumberFormat extends Format{
|
||||
* since the <code>int</code> fields were not present in JDK 1.1.
|
||||
* Finally, set serialVersionOnStream back to the maximum allowed value so that
|
||||
* default serialization will work properly if this object is streamed out again.
|
||||
*
|
||||
*/
|
||||
private void readObject(ObjectInputStream stream)
|
||||
throws IOException, ClassNotFoundException
|
||||
@ -1026,7 +1055,6 @@ public abstract class NumberFormat extends Format{
|
||||
* equal to the <code>int</code> fields such as <code>maximumIntegerDigits</code>
|
||||
* (or to <code>Byte.MAX_VALUE</code>, whichever is smaller), for compatibility
|
||||
* with the JDK 1.1 version of the stream format.
|
||||
*
|
||||
*/
|
||||
private void writeObject(ObjectOutputStream stream)
|
||||
throws IOException
|
||||
|
Loading…
Reference in New Issue
Block a user