mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
Minor coding style update of javadoc tag in any file in java.base Reviewed-by: bchristi, lancea
This commit is contained in:
parent
13d0bac294
commit
d15a57b842
139 changed files with 3499 additions and 3499 deletions
|
@ -117,7 +117,7 @@ public class AttributedString {
|
|||
/**
|
||||
* Constructs an AttributedString instance with the given text.
|
||||
* @param text The text for this attributed string.
|
||||
* @throws NullPointerException if <code>text</code> is null.
|
||||
* @throws NullPointerException if {@code text} is null.
|
||||
*/
|
||||
public AttributedString(String text) {
|
||||
if (text == null) {
|
||||
|
@ -130,8 +130,8 @@ public class AttributedString {
|
|||
* Constructs an AttributedString instance with the given text and attributes.
|
||||
* @param text The text for this attributed string.
|
||||
* @param attributes The attributes that apply to the entire string.
|
||||
* @throws NullPointerException if <code>text</code> or
|
||||
* <code>attributes</code> is null.
|
||||
* @throws NullPointerException if {@code text} or
|
||||
* {@code attributes} is null.
|
||||
* @throws IllegalArgumentException if the text has length 0
|
||||
* and the attributes parameter is not an empty Map (attributes
|
||||
* cannot be applied to a 0-length range).
|
||||
|
@ -171,7 +171,7 @@ public class AttributedString {
|
|||
* Constructs an AttributedString instance with the given attributed
|
||||
* text represented by AttributedCharacterIterator.
|
||||
* @param text The text for this attributed string.
|
||||
* @throws NullPointerException if <code>text</code> is null.
|
||||
* @throws NullPointerException if {@code text} is null.
|
||||
*/
|
||||
public AttributedString(AttributedCharacterIterator text) {
|
||||
// If performance is critical, this constructor should be
|
||||
|
@ -192,7 +192,7 @@ public class AttributedString {
|
|||
* @param beginIndex Index of the first character of the range.
|
||||
* @param endIndex Index of the character following the last character
|
||||
* of the range.
|
||||
* @throws NullPointerException if <code>text</code> is null.
|
||||
* @throws NullPointerException if {@code text} is null.
|
||||
* @throws IllegalArgumentException if the subrange given by
|
||||
* beginIndex and endIndex is out of the text range.
|
||||
* @see java.text.Annotation
|
||||
|
@ -220,7 +220,7 @@ public class AttributedString {
|
|||
* @param attributes Specifies attributes to be extracted
|
||||
* from the text. If null is specified, all available attributes will
|
||||
* be used.
|
||||
* @throws NullPointerException if <code>text</code> is null.
|
||||
* @throws NullPointerException if {@code text} is null.
|
||||
* @throws IllegalArgumentException if the subrange given by
|
||||
* beginIndex and endIndex is out of the text range.
|
||||
* @see java.text.Annotation
|
||||
|
@ -307,7 +307,7 @@ public class AttributedString {
|
|||
* Adds an attribute to the entire string.
|
||||
* @param attribute the attribute key
|
||||
* @param value the value of the attribute; may be null
|
||||
* @throws NullPointerException if <code>attribute</code> is null.
|
||||
* @throws NullPointerException if {@code attribute} is null.
|
||||
* @throws IllegalArgumentException if the AttributedString has length 0
|
||||
* (attributes cannot be applied to a 0-length range).
|
||||
*/
|
||||
|
@ -331,7 +331,7 @@ public class AttributedString {
|
|||
* @param value The value of the attribute. May be null.
|
||||
* @param beginIndex Index of the first character of the range.
|
||||
* @param endIndex Index of the character following the last character of the range.
|
||||
* @throws NullPointerException if <code>attribute</code> is null.
|
||||
* @throws NullPointerException if {@code attribute} is null.
|
||||
* @throws IllegalArgumentException if beginIndex is less than 0, endIndex is
|
||||
* greater than the length of the string, or beginIndex and endIndex together don't
|
||||
* define a non-empty subrange of the string.
|
||||
|
@ -356,7 +356,7 @@ public class AttributedString {
|
|||
* @param beginIndex Index of the first character of the range.
|
||||
* @param endIndex Index of the character following the last
|
||||
* character of the range.
|
||||
* @throws NullPointerException if <code>attributes</code> is null.
|
||||
* @throws NullPointerException if {@code attributes} is null.
|
||||
* @throws IllegalArgumentException if beginIndex is less than
|
||||
* 0, endIndex is greater than the length of the string, or
|
||||
* beginIndex and endIndex together don't define a non-empty
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -261,7 +261,7 @@ public final class Bidi {
|
|||
|
||||
/**
|
||||
* Return the level of the nth logical run in this line.
|
||||
* @param run the index of the run, between 0 and <code>getRunCount()</code>
|
||||
* @param run the index of the run, between 0 and {@code getRunCount()}
|
||||
* @return the level of the run
|
||||
*/
|
||||
public int getRunLevel(int run) {
|
||||
|
@ -271,7 +271,7 @@ public final class Bidi {
|
|||
/**
|
||||
* Return the index of the character at the start of the nth logical run in this line, as
|
||||
* an offset from the start of the line.
|
||||
* @param run the index of the run, between 0 and <code>getRunCount()</code>
|
||||
* @param run the index of the run, between 0 and {@code getRunCount()}
|
||||
* @return the start of the run
|
||||
*/
|
||||
public int getRunStart(int run) {
|
||||
|
@ -282,7 +282,7 @@ public final class Bidi {
|
|||
* Return the index of the character past the end of the nth logical run in this line, as
|
||||
* an offset from the start of the line. For example, this will return the length
|
||||
* of the line for the last run on the line.
|
||||
* @param run the index of the run, between 0 and <code>getRunCount()</code>
|
||||
* @param run the index of the run, between 0 and {@code getRunCount()}
|
||||
* @return limit the limit of the run
|
||||
*/
|
||||
public int getRunLimit(int run) {
|
||||
|
@ -308,11 +308,11 @@ public final class Bidi {
|
|||
* Reorder the objects in the array into visual order based on their levels.
|
||||
* This is a utility function to use when you have a collection of objects
|
||||
* representing runs of text in logical order, each run containing text
|
||||
* at a single level. The elements at <code>index</code> from
|
||||
* <code>objectStart</code> up to <code>objectStart + count</code>
|
||||
* at a single level. The elements at {@code index} from
|
||||
* {@code objectStart} up to {@code objectStart + count}
|
||||
* in the objects array will be reordered into visual order assuming
|
||||
* each run of text has the level indicated by the corresponding element
|
||||
* in the levels array (at <code>index - objectStart + levelStart</code>).
|
||||
* in the levels array (at {@code index - objectStart + levelStart}).
|
||||
*
|
||||
* @param levels an array representing the bidi level of each object
|
||||
* @param levelStart the start position in the levels array
|
||||
|
|
|
@ -48,23 +48,23 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
|
|||
|
||||
|
||||
/**
|
||||
* The <code>BreakIterator</code> class implements methods for finding
|
||||
* the location of boundaries in text. Instances of <code>BreakIterator</code>
|
||||
* The {@code BreakIterator} class implements methods for finding
|
||||
* the location of boundaries in text. Instances of {@code BreakIterator}
|
||||
* maintain a current position and scan over text
|
||||
* returning the index of characters where boundaries occur.
|
||||
* Internally, <code>BreakIterator</code> scans text using a
|
||||
* <code>CharacterIterator</code>, and is thus able to scan text held
|
||||
* by any object implementing that protocol. A <code>StringCharacterIterator</code>
|
||||
* is used to scan <code>String</code> objects passed to <code>setText</code>.
|
||||
* Internally, {@code BreakIterator} scans text using a
|
||||
* {@code CharacterIterator}, and is thus able to scan text held
|
||||
* by any object implementing that protocol. A {@code StringCharacterIterator}
|
||||
* is used to scan {@code String} objects passed to {@code setText}.
|
||||
*
|
||||
* <p>
|
||||
* You use the factory methods provided by this class to create
|
||||
* instances of various types of break iterators. In particular,
|
||||
* use <code>getWordInstance</code>, <code>getLineInstance</code>,
|
||||
* <code>getSentenceInstance</code>, and <code>getCharacterInstance</code>
|
||||
* to create <code>BreakIterator</code>s that perform
|
||||
* use {@code getWordInstance}, {@code getLineInstance},
|
||||
* {@code getSentenceInstance}, and {@code getCharacterInstance}
|
||||
* to create {@code BreakIterator}s that perform
|
||||
* word, line, sentence, and character boundary analysis respectively.
|
||||
* A single <code>BreakIterator</code> can work only on one unit
|
||||
* A single {@code BreakIterator} can work only on one unit
|
||||
* (word, line, sentence, and so on). You must use a different iterator
|
||||
* for each unit boundary analysis you wish to perform.
|
||||
*
|
||||
|
@ -100,7 +100,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
|
|||
* differ between languages.
|
||||
*
|
||||
* <p>
|
||||
* The <code>BreakIterator</code> instances returned by the factory methods
|
||||
* The {@code BreakIterator} instances returned by the factory methods
|
||||
* of this class are intended for use with natural languages only, not for
|
||||
* programming language text. It is however possible to define subclasses
|
||||
* that tokenize a programming language.
|
||||
|
@ -274,31 +274,31 @@ public abstract class BreakIterator implements Cloneable
|
|||
/**
|
||||
* Returns the nth boundary from the current boundary. If either
|
||||
* the first or last text boundary has been reached, it returns
|
||||
* <code>BreakIterator.DONE</code> and the current position is set to either
|
||||
* {@code BreakIterator.DONE} and the current position is set to either
|
||||
* the first or last text boundary depending on which one is reached. Otherwise,
|
||||
* the iterator's current position is set to the new boundary.
|
||||
* For example, if the iterator's current position is the mth text boundary
|
||||
* and three more boundaries exist from the current boundary to the last text
|
||||
* boundary, the next(2) call will return m + 2. The new text position is set
|
||||
* to the (m + 2)th text boundary. A next(4) call would return
|
||||
* <code>BreakIterator.DONE</code> and the last text boundary would become the
|
||||
* {@code BreakIterator.DONE} and the last text boundary would become the
|
||||
* new text position.
|
||||
* @param n which boundary to return. A value of 0
|
||||
* does nothing. Negative values move to previous boundaries
|
||||
* and positive values move to later boundaries.
|
||||
* @return The character index of the nth boundary from the current position
|
||||
* or <code>BreakIterator.DONE</code> if either first or last text boundary
|
||||
* or {@code BreakIterator.DONE} if either first or last text boundary
|
||||
* has been reached.
|
||||
*/
|
||||
public abstract int next(int n);
|
||||
|
||||
/**
|
||||
* Returns the boundary following the current boundary. If the current boundary
|
||||
* is the last text boundary, it returns <code>BreakIterator.DONE</code> and
|
||||
* is the last text boundary, it returns {@code BreakIterator.DONE} and
|
||||
* the iterator's current position is unchanged. Otherwise, the iterator's
|
||||
* current position is set to the boundary following the current boundary.
|
||||
* @return The character index of the next text boundary or
|
||||
* <code>BreakIterator.DONE</code> if the current boundary is the last text
|
||||
* {@code BreakIterator.DONE} if the current boundary is the last text
|
||||
* boundary.
|
||||
* Equivalent to next(1).
|
||||
* @see #next(int)
|
||||
|
@ -307,11 +307,11 @@ public abstract class BreakIterator implements Cloneable
|
|||
|
||||
/**
|
||||
* Returns the boundary preceding the current boundary. If the current boundary
|
||||
* is the first text boundary, it returns <code>BreakIterator.DONE</code> and
|
||||
* is the first text boundary, it returns {@code BreakIterator.DONE} and
|
||||
* the iterator's current position is unchanged. Otherwise, the iterator's
|
||||
* current position is set to the boundary preceding the current boundary.
|
||||
* @return The character index of the previous text boundary or
|
||||
* <code>BreakIterator.DONE</code> if the current boundary is the first text
|
||||
* {@code BreakIterator.DONE} if the current boundary is the first text
|
||||
* boundary.
|
||||
*/
|
||||
public abstract int previous();
|
||||
|
@ -319,13 +319,13 @@ public abstract class BreakIterator implements Cloneable
|
|||
/**
|
||||
* Returns the first boundary following the specified character offset. If the
|
||||
* specified offset equals to the last text boundary, it returns
|
||||
* <code>BreakIterator.DONE</code> and the iterator's current position is unchanged.
|
||||
* {@code BreakIterator.DONE} and the iterator's current position is unchanged.
|
||||
* Otherwise, the iterator's current position is set to the returned boundary.
|
||||
* The value returned is always greater than the offset or the value
|
||||
* <code>BreakIterator.DONE</code>.
|
||||
* {@code BreakIterator.DONE}.
|
||||
* @param offset the character offset to begin scanning.
|
||||
* @return The first boundary after the specified offset or
|
||||
* <code>BreakIterator.DONE</code> if the last text boundary is passed in
|
||||
* {@code BreakIterator.DONE} if the last text boundary is passed in
|
||||
* as the offset.
|
||||
* @throws IllegalArgumentException if the specified offset is less than
|
||||
* the first text boundary or greater than the last text boundary.
|
||||
|
@ -335,13 +335,13 @@ public abstract class BreakIterator implements Cloneable
|
|||
/**
|
||||
* Returns the last boundary preceding the specified character offset. If the
|
||||
* specified offset equals to the first text boundary, it returns
|
||||
* <code>BreakIterator.DONE</code> and the iterator's current position is unchanged.
|
||||
* {@code BreakIterator.DONE} and the iterator's current position is unchanged.
|
||||
* Otherwise, the iterator's current position is set to the returned boundary.
|
||||
* The value returned is always less than the offset or the value
|
||||
* <code>BreakIterator.DONE</code>.
|
||||
* {@code BreakIterator.DONE}.
|
||||
* @param offset the character offset to begin scanning.
|
||||
* @return The last boundary before the specified offset or
|
||||
* <code>BreakIterator.DONE</code> if the first text boundary is passed in
|
||||
* {@code BreakIterator.DONE} if the first text boundary is passed in
|
||||
* as the offset.
|
||||
* @throws IllegalArgumentException if the specified offset is less than
|
||||
* the first text boundary or greater than the last text boundary.
|
||||
|
@ -361,8 +361,8 @@ public abstract class BreakIterator implements Cloneable
|
|||
/**
|
||||
* Returns true if the specified character offset is a text boundary.
|
||||
* @param offset the character offset to check.
|
||||
* @return <code>true</code> if "offset" is a boundary position,
|
||||
* <code>false</code> otherwise.
|
||||
* @return {@code true} if "offset" is a boundary position,
|
||||
* {@code false} otherwise.
|
||||
* @throws IllegalArgumentException if the specified offset is less than
|
||||
* the first text boundary or greater than the last text boundary.
|
||||
* @since 1.2
|
||||
|
@ -390,7 +390,7 @@ public abstract class BreakIterator implements Cloneable
|
|||
* Returns character index of the text boundary that was most
|
||||
* recently returned by next(), next(int), previous(), first(), last(),
|
||||
* following(int) or preceding(int). If any of these methods returns
|
||||
* <code>BreakIterator.DONE</code> because either first or last text boundary
|
||||
* {@code BreakIterator.DONE} because either first or last text boundary
|
||||
* has been reached, it returns the first or last text boundary depending on
|
||||
* which one is reached.
|
||||
* @return The text boundary returned from the above methods, first or last
|
||||
|
@ -437,7 +437,7 @@ public abstract class BreakIterator implements Cloneable
|
|||
private static final SoftReference<BreakIteratorCache>[] iterCache = (SoftReference<BreakIteratorCache>[]) new SoftReference<?>[4];
|
||||
|
||||
/**
|
||||
* Returns a new <code>BreakIterator</code> instance
|
||||
* Returns a new {@code BreakIterator} instance
|
||||
* for <a href="BreakIterator.html#word">word breaks</a>
|
||||
* for the {@linkplain Locale#getDefault() default locale}.
|
||||
* @return A break iterator for word breaks
|
||||
|
@ -448,12 +448,12 @@ public abstract class BreakIterator implements Cloneable
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new <code>BreakIterator</code> instance
|
||||
* Returns a new {@code BreakIterator} instance
|
||||
* for <a href="BreakIterator.html#word">word breaks</a>
|
||||
* for the given locale.
|
||||
* @param locale the desired locale
|
||||
* @return A break iterator for word breaks
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
*/
|
||||
public static BreakIterator getWordInstance(Locale locale)
|
||||
{
|
||||
|
@ -461,7 +461,7 @@ public abstract class BreakIterator implements Cloneable
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new <code>BreakIterator</code> instance
|
||||
* Returns a new {@code BreakIterator} instance
|
||||
* for <a href="BreakIterator.html#line">line breaks</a>
|
||||
* for the {@linkplain Locale#getDefault() default locale}.
|
||||
* @return A break iterator for line breaks
|
||||
|
@ -472,12 +472,12 @@ public abstract class BreakIterator implements Cloneable
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new <code>BreakIterator</code> instance
|
||||
* Returns a new {@code BreakIterator} instance
|
||||
* for <a href="BreakIterator.html#line">line breaks</a>
|
||||
* for the given locale.
|
||||
* @param locale the desired locale
|
||||
* @return A break iterator for line breaks
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
*/
|
||||
public static BreakIterator getLineInstance(Locale locale)
|
||||
{
|
||||
|
@ -485,7 +485,7 @@ public abstract class BreakIterator implements Cloneable
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new <code>BreakIterator</code> instance
|
||||
* Returns a new {@code BreakIterator} instance
|
||||
* for <a href="BreakIterator.html#character">character breaks</a>
|
||||
* for the {@linkplain Locale#getDefault() default locale}.
|
||||
* @return A break iterator for character breaks
|
||||
|
@ -496,12 +496,12 @@ public abstract class BreakIterator implements Cloneable
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new <code>BreakIterator</code> instance
|
||||
* Returns a new {@code BreakIterator} instance
|
||||
* for <a href="BreakIterator.html#character">character breaks</a>
|
||||
* for the given locale.
|
||||
* @param locale the desired locale
|
||||
* @return A break iterator for character breaks
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
*/
|
||||
public static BreakIterator getCharacterInstance(Locale locale)
|
||||
{
|
||||
|
@ -509,7 +509,7 @@ public abstract class BreakIterator implements Cloneable
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new <code>BreakIterator</code> instance
|
||||
* Returns a new {@code BreakIterator} instance
|
||||
* for <a href="BreakIterator.html#sentence">sentence breaks</a>
|
||||
* for the {@linkplain Locale#getDefault() default locale}.
|
||||
* @return A break iterator for sentence breaks
|
||||
|
@ -520,12 +520,12 @@ public abstract class BreakIterator implements Cloneable
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new <code>BreakIterator</code> instance
|
||||
* Returns a new {@code BreakIterator} instance
|
||||
* for <a href="BreakIterator.html#sentence">sentence breaks</a>
|
||||
* for the given locale.
|
||||
* @param locale the desired locale
|
||||
* @return A break iterator for sentence breaks
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
*/
|
||||
public static BreakIterator getSentenceInstance(Locale locale)
|
||||
{
|
||||
|
@ -580,16 +580,16 @@ public abstract class BreakIterator implements Cloneable
|
|||
|
||||
/**
|
||||
* Returns an array of all locales for which the
|
||||
* <code>get*Instance</code> methods of this class can return
|
||||
* {@code get*Instance} methods of this class can return
|
||||
* localized instances.
|
||||
* The returned array represents the union of locales supported by the Java
|
||||
* runtime and by installed
|
||||
* {@link java.text.spi.BreakIteratorProvider BreakIteratorProvider} implementations.
|
||||
* It must contain at least a <code>Locale</code>
|
||||
* It must contain at least a {@code Locale}
|
||||
* instance equal to {@link java.util.Locale#US Locale.US}.
|
||||
*
|
||||
* @return An array of locales for which localized
|
||||
* <code>BreakIterator</code> instances are available.
|
||||
* {@code BreakIterator} instances are available.
|
||||
*/
|
||||
public static synchronized Locale[] getAvailableLocales()
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -28,16 +28,16 @@ import java.util.ArrayList;
|
|||
|
||||
/**
|
||||
* CharacterIteratorFieldDelegate combines the notifications from a Format
|
||||
* into a resulting <code>AttributedCharacterIterator</code>. The resulting
|
||||
* <code>AttributedCharacterIterator</code> can be retrieved by way of
|
||||
* the <code>getIterator</code> method.
|
||||
* into a resulting {@code AttributedCharacterIterator}. The resulting
|
||||
* {@code AttributedCharacterIterator} can be retrieved by way of
|
||||
* the {@code getIterator} method.
|
||||
*
|
||||
*/
|
||||
class CharacterIteratorFieldDelegate implements Format.FieldDelegate {
|
||||
/**
|
||||
* Array of AttributeStrings. Whenever <code>formatted</code> is invoked
|
||||
* Array of AttributeStrings. Whenever {@code formatted} is invoked
|
||||
* for a region > size, a new instance of AttributedString is added to
|
||||
* attributedStrings. Subsequent invocations of <code>formatted</code>
|
||||
* attributedStrings. Subsequent invocations of {@code formatted}
|
||||
* for existing regions result in invoking addAttribute on the existing
|
||||
* AttributedStrings.
|
||||
*/
|
||||
|
@ -98,7 +98,7 @@ class CharacterIteratorFieldDelegate implements Format.FieldDelegate {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an <code>AttributedCharacterIterator</code> that can be used
|
||||
* Returns an {@code AttributedCharacterIterator} that can be used
|
||||
* to iterate over the resulting formatted String.
|
||||
*
|
||||
* @pararm string Result of formatting.
|
||||
|
|
|
@ -44,8 +44,8 @@ import java.io.ObjectInputStream;
|
|||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* A <code>ChoiceFormat</code> allows you to attach a format to a range of numbers.
|
||||
* It is generally used in a <code>MessageFormat</code> for handling plurals.
|
||||
* A {@code ChoiceFormat} allows you to attach a format to a range of numbers.
|
||||
* It is generally used in a {@code MessageFormat} for handling plurals.
|
||||
* The choice is specified with an ascending list of doubles, where each item
|
||||
* specifies a half-open interval up to the next item:
|
||||
* <blockquote>
|
||||
|
@ -60,15 +60,15 @@ import java.util.Arrays;
|
|||
*
|
||||
* <p>
|
||||
* <strong>Note:</strong>
|
||||
* <code>ChoiceFormat</code> differs from the other <code>Format</code>
|
||||
* classes in that you create a <code>ChoiceFormat</code> object with a
|
||||
* constructor (not with a <code>getInstance</code> style factory
|
||||
* method). The factory methods aren't necessary because <code>ChoiceFormat</code>
|
||||
* {@code ChoiceFormat} differs from the other {@code Format}
|
||||
* classes in that you create a {@code ChoiceFormat} object with a
|
||||
* constructor (not with a {@code getInstance} style factory
|
||||
* method). The factory methods aren't necessary because {@code ChoiceFormat}
|
||||
* doesn't require any complex setup for a given locale. In fact,
|
||||
* <code>ChoiceFormat</code> doesn't implement any locale specific behavior.
|
||||
* {@code ChoiceFormat} doesn't implement any locale specific behavior.
|
||||
*
|
||||
* <p>
|
||||
* When creating a <code>ChoiceFormat</code>, you must specify an array of formats
|
||||
* When creating a {@code ChoiceFormat}, you must specify an array of formats
|
||||
* and an array of limits. The length of these arrays must be the same.
|
||||
* For example,
|
||||
* <ul>
|
||||
|
@ -78,7 +78,7 @@ import java.util.Arrays;
|
|||
* <li>
|
||||
* <em>limits</em> = {0, 1, ChoiceFormat.nextDouble(1)}<br>
|
||||
* <em>formats</em> = {"no files", "one file", "many files"}<br>
|
||||
* (<code>nextDouble</code> can be used to get the next higher double, to
|
||||
* ({@code nextDouble} can be used to get the next higher double, to
|
||||
* make the half-open interval.)
|
||||
* </ul>
|
||||
*
|
||||
|
@ -381,7 +381,7 @@ public class ChoiceFormat extends NumberFormat {
|
|||
|
||||
/**
|
||||
* Specialization of format. This method really calls
|
||||
* <code>format(double, StringBuffer, FieldPosition)</code>
|
||||
* {@code format(double, StringBuffer, FieldPosition)}
|
||||
* thus the range of longs that are supported is only equal to
|
||||
* the range that can be stored by double. This will never be
|
||||
* a practical limitation.
|
||||
|
@ -542,16 +542,16 @@ public class ChoiceFormat extends NumberFormat {
|
|||
|
||||
/**
|
||||
* A list of lower bounds for the choices. The formatter will return
|
||||
* <code>choiceFormats[i]</code> if the number being formatted is greater than or equal to
|
||||
* <code>choiceLimits[i]</code> and less than <code>choiceLimits[i+1]</code>.
|
||||
* {@code choiceFormats[i]} if the number being formatted is greater than or equal to
|
||||
* {@code choiceLimits[i]} and less than {@code choiceLimits[i+1]}.
|
||||
* @serial
|
||||
*/
|
||||
private double[] choiceLimits;
|
||||
|
||||
/**
|
||||
* A list of choice strings. The formatter will return
|
||||
* <code>choiceFormats[i]</code> if the number being formatted is greater than or equal to
|
||||
* <code>choiceLimits[i]</code> and less than <code>choiceLimits[i+1]</code>.
|
||||
* {@code choiceFormats[i]} if the number being formatted is greater than or equal to
|
||||
* {@code choiceLimits[i]} and less than {@code choiceLimits[i+1]}.
|
||||
* @serial
|
||||
*/
|
||||
private String[] choiceFormats;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -44,7 +44,7 @@ import sun.text.CollatorUtilities;
|
|||
import sun.text.normalizer.NormalizerBase;
|
||||
|
||||
/**
|
||||
* The <code>CollationElementIterator</code> class is used as an iterator
|
||||
* The {@code CollationElementIterator} class is used as an iterator
|
||||
* to walk through each character of an international string. Use the iterator
|
||||
* to return the ordering priority of the positioned character. The ordering
|
||||
* priority of a character, which we refer to as a key, defines how a character
|
||||
|
@ -68,9 +68,9 @@ import sun.text.normalizer.NormalizerBase;
|
|||
* The key of a character is an integer composed of primary order(short),
|
||||
* secondary order(byte), and tertiary order(byte). Java strictly defines
|
||||
* the size and signedness of its primitive data types. Therefore, the static
|
||||
* functions <code>primaryOrder</code>, <code>secondaryOrder</code>, and
|
||||
* <code>tertiaryOrder</code> return <code>int</code>, <code>short</code>,
|
||||
* and <code>short</code> respectively to ensure the correctness of the key
|
||||
* functions {@code primaryOrder}, {@code secondaryOrder}, and
|
||||
* {@code tertiaryOrder} return {@code int}, {@code short},
|
||||
* and {@code short} respectively to ensure the correctness of the key
|
||||
* value.
|
||||
*
|
||||
* <p>
|
||||
|
@ -90,16 +90,16 @@ import sun.text.normalizer.NormalizerBase;
|
|||
* </blockquote>
|
||||
*
|
||||
* <p>
|
||||
* <code>CollationElementIterator.next</code> returns the collation order
|
||||
* {@code CollationElementIterator.next} returns the collation order
|
||||
* of the next character. A collation order consists of primary order,
|
||||
* secondary order and tertiary order. The data type of the collation
|
||||
* order is <strong>int</strong>. The first 16 bits of a collation order
|
||||
* is its primary order; the next 8 bits is the secondary order and the
|
||||
* last 8 bits is the tertiary order.
|
||||
*
|
||||
* <p><b>Note:</b> <code>CollationElementIterator</code> is a part of
|
||||
* <code>RuleBasedCollator</code> implementation. It is only usable
|
||||
* with <code>RuleBasedCollator</code> instances.
|
||||
* <p><b>Note:</b> {@code CollationElementIterator} is a part of
|
||||
* {@code RuleBasedCollator} implementation. It is only usable
|
||||
* with {@code RuleBasedCollator} instances.
|
||||
*
|
||||
* @see Collator
|
||||
* @see RuleBasedCollator
|
||||
|
|
|
@ -39,34 +39,34 @@
|
|||
package java.text;
|
||||
|
||||
/**
|
||||
* A <code>CollationKey</code> represents a <code>String</code> under the
|
||||
* rules of a specific <code>Collator</code> object. Comparing two
|
||||
* <code>CollationKey</code>s returns the relative order of the
|
||||
* <code>String</code>s they represent. Using <code>CollationKey</code>s
|
||||
* to compare <code>String</code>s is generally faster than using
|
||||
* <code>Collator.compare</code>. Thus, when the <code>String</code>s
|
||||
* A {@code CollationKey} represents a {@code String} under the
|
||||
* rules of a specific {@code Collator} object. Comparing two
|
||||
* {@code CollationKey}s returns the relative order of the
|
||||
* {@code String}s they represent. Using {@code CollationKey}s
|
||||
* to compare {@code String}s is generally faster than using
|
||||
* {@code Collator.compare}. Thus, when the {@code String}s
|
||||
* must be compared multiple times, for example when sorting a list
|
||||
* of <code>String</code>s. It's more efficient to use <code>CollationKey</code>s.
|
||||
* of {@code String}s. It's more efficient to use {@code CollationKey}s.
|
||||
*
|
||||
* <p>
|
||||
* You can not create <code>CollationKey</code>s directly. Rather,
|
||||
* generate them by calling <code>Collator.getCollationKey</code>.
|
||||
* You can only compare <code>CollationKey</code>s generated from
|
||||
* the same <code>Collator</code> object.
|
||||
* You can not create {@code CollationKey}s directly. Rather,
|
||||
* generate them by calling {@code Collator.getCollationKey}.
|
||||
* You can only compare {@code CollationKey}s generated from
|
||||
* the same {@code Collator} object.
|
||||
*
|
||||
* <p>
|
||||
* Generating a <code>CollationKey</code> for a <code>String</code>
|
||||
* involves examining the entire <code>String</code>
|
||||
* Generating a {@code CollationKey} for a {@code String}
|
||||
* involves examining the entire {@code String}
|
||||
* and converting it to series of bits that can be compared bitwise. This
|
||||
* allows fast comparisons once the keys are generated. The cost of generating
|
||||
* keys is recouped in faster comparisons when <code>String</code>s need
|
||||
* keys is recouped in faster comparisons when {@code String}s need
|
||||
* to be compared many times. On the other hand, the result of a comparison
|
||||
* is often determined by the first couple of characters of each <code>String</code>.
|
||||
* <code>Collator.compare</code> examines only as many characters as it needs which
|
||||
* is often determined by the first couple of characters of each {@code String}.
|
||||
* {@code Collator.compare} examines only as many characters as it needs which
|
||||
* allows it to be faster when doing single comparisons.
|
||||
* <p>
|
||||
* The following example shows how <code>CollationKey</code>s might be used
|
||||
* to sort a list of <code>String</code>s.
|
||||
* The following example shows how {@code CollationKey}s might be used
|
||||
* to sort a list of {@code String}s.
|
||||
* <blockquote>
|
||||
* <pre>{@code
|
||||
* // Create an array of CollationKeys for the Strings to be sorted.
|
||||
|
|
|
@ -49,28 +49,28 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
|
|||
|
||||
|
||||
/**
|
||||
* The <code>Collator</code> class performs locale-sensitive
|
||||
* <code>String</code> comparison. You use this class to build
|
||||
* The {@code Collator} class performs locale-sensitive
|
||||
* {@code String} comparison. You use this class to build
|
||||
* searching and sorting routines for natural language text.
|
||||
*
|
||||
* <p>
|
||||
* <code>Collator</code> is an abstract base class. Subclasses
|
||||
* {@code Collator} is an abstract base class. Subclasses
|
||||
* implement specific collation strategies. One subclass,
|
||||
* <code>RuleBasedCollator</code>, is currently provided with
|
||||
* {@code RuleBasedCollator}, is currently provided with
|
||||
* the Java Platform and is applicable to a wide set of languages. Other
|
||||
* subclasses may be created to handle more specialized needs.
|
||||
*
|
||||
* <p>
|
||||
* Like other locale-sensitive classes, you can use the static
|
||||
* factory method, <code>getInstance</code>, to obtain the appropriate
|
||||
* <code>Collator</code> object for a given locale. You will only need
|
||||
* to look at the subclasses of <code>Collator</code> if you need
|
||||
* factory method, {@code getInstance}, to obtain the appropriate
|
||||
* {@code Collator} object for a given locale. You will only need
|
||||
* to look at the subclasses of {@code Collator} if you need
|
||||
* to understand the details of a particular collation strategy or
|
||||
* if you need to modify that strategy.
|
||||
*
|
||||
* <p>
|
||||
* The following example shows how to compare two strings using
|
||||
* the <code>Collator</code> for the default locale.
|
||||
* the {@code Collator} for the default locale.
|
||||
* <blockquote>
|
||||
* <pre>{@code
|
||||
* // Compare two strings in the default locale
|
||||
|
@ -83,10 +83,10 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
|
|||
* </blockquote>
|
||||
*
|
||||
* <p>
|
||||
* You can set a <code>Collator</code>'s <em>strength</em> property
|
||||
* You can set a {@code Collator}'s <em>strength</em> property
|
||||
* to determine the level of difference considered significant in
|
||||
* comparisons. Four strengths are provided: <code>PRIMARY</code>,
|
||||
* <code>SECONDARY</code>, <code>TERTIARY</code>, and <code>IDENTICAL</code>.
|
||||
* comparisons. Four strengths are provided: {@code PRIMARY},
|
||||
* {@code SECONDARY}, {@code TERTIARY}, and {@code IDENTICAL}.
|
||||
* The exact assignment of strengths to language features is
|
||||
* locale dependent. For example, in Czech, "e" and "f" are considered
|
||||
* primary differences, while "e" and "ě" are secondary differences,
|
||||
|
@ -104,19 +104,19 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
|
|||
* </pre>
|
||||
* </blockquote>
|
||||
* <p>
|
||||
* For comparing <code>String</code>s exactly once, the <code>compare</code>
|
||||
* For comparing {@code String}s exactly once, the {@code compare}
|
||||
* method provides the best performance. When sorting a list of
|
||||
* <code>String</code>s however, it is generally necessary to compare each
|
||||
* <code>String</code> multiple times. In this case, <code>CollationKey</code>s
|
||||
* provide better performance. The <code>CollationKey</code> class converts
|
||||
* a <code>String</code> to a series of bits that can be compared bitwise
|
||||
* against other <code>CollationKey</code>s. A <code>CollationKey</code> is
|
||||
* created by a <code>Collator</code> object for a given <code>String</code>.
|
||||
* {@code String}s however, it is generally necessary to compare each
|
||||
* {@code String} multiple times. In this case, {@code CollationKey}s
|
||||
* provide better performance. The {@code CollationKey} class converts
|
||||
* a {@code String} to a series of bits that can be compared bitwise
|
||||
* against other {@code CollationKey}s. A {@code CollationKey} is
|
||||
* created by a {@code Collator} object for a given {@code String}.
|
||||
* <br>
|
||||
* <strong>Note:</strong> <code>CollationKey</code>s from different
|
||||
* <code>Collator</code>s can not be compared. See the class description
|
||||
* <strong>Note:</strong> {@code CollationKey}s from different
|
||||
* {@code Collator}s can not be compared. See the class description
|
||||
* for {@link CollationKey}
|
||||
* for an example using <code>CollationKey</code>s.
|
||||
* for an example using {@code CollationKey}s.
|
||||
*
|
||||
* @see RuleBasedCollator
|
||||
* @see CollationKey
|
||||
|
@ -291,7 +291,7 @@ public abstract class Collator
|
|||
* to, or greater than the second.
|
||||
* <p>
|
||||
* This implementation merely returns
|
||||
* <code> compare((String)o1, (String)o2) </code>.
|
||||
* {@code compare((String)o1, (String)o2) }.
|
||||
*
|
||||
* @return a negative integer, zero, or a positive integer as the
|
||||
* first argument is less than, equal to, or greater than the
|
||||
|
@ -416,7 +416,7 @@ public abstract class Collator
|
|||
|
||||
/**
|
||||
* Returns an array of all locales for which the
|
||||
* <code>getInstance</code> methods of this class can return
|
||||
* {@code getInstance} methods of this class can return
|
||||
* localized instances.
|
||||
* The returned array represents the union of locales supported
|
||||
* by the Java runtime and by installed
|
||||
|
@ -425,7 +425,7 @@ public abstract class Collator
|
|||
* {@link java.util.Locale#US Locale.US}.
|
||||
*
|
||||
* @return An array of locales for which localized
|
||||
* <code>Collator</code> instances are available.
|
||||
* {@code Collator} instances are available.
|
||||
*/
|
||||
public static synchronized Locale[] getAvailableLocales() {
|
||||
LocaleServiceProviderPool pool =
|
||||
|
|
|
@ -58,7 +58,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
|
|||
* formats and parses dates or time in a language-independent manner.
|
||||
* The date/time formatting subclass, such as {@link SimpleDateFormat}, allows for
|
||||
* formatting (i.e., date → text), parsing (text → date), and
|
||||
* normalization. The date is represented as a <code>Date</code> object or
|
||||
* normalization. The date is represented as a {@code Date} object or
|
||||
* as the milliseconds since January 1, 1970, 00:00:00 GMT.
|
||||
*
|
||||
* <p>{@code DateFormat} provides many class methods for obtaining default date/time
|
||||
|
@ -185,15 +185,15 @@ public abstract class DateFormat extends Format {
|
|||
*
|
||||
* <p>Subclasses should initialize this field to a {@link Calendar}
|
||||
* appropriate for the {@link Locale} associated with this
|
||||
* <code>DateFormat</code>.
|
||||
* {@code DateFormat}.
|
||||
* @serial
|
||||
*/
|
||||
protected Calendar calendar;
|
||||
|
||||
/**
|
||||
* The number formatter that <code>DateFormat</code> uses to format numbers
|
||||
* The number formatter that {@code DateFormat} uses to format numbers
|
||||
* in dates and times. Subclasses should initialize this to a number format
|
||||
* appropriate for the locale associated with this <code>DateFormat</code>.
|
||||
* appropriate for the locale associated with this {@code DateFormat}.
|
||||
* @serial
|
||||
*/
|
||||
protected NumberFormat numberFormat;
|
||||
|
@ -383,8 +383,8 @@ public abstract class DateFormat extends Format {
|
|||
* See the {@link #parse(String, ParsePosition)} method for more information
|
||||
* on date parsing.
|
||||
*
|
||||
* @param source A <code>String</code> whose beginning should be parsed.
|
||||
* @return A <code>Date</code> parsed from the string.
|
||||
* @param source A {@code String} whose beginning should be parsed.
|
||||
* @return A {@code Date} parsed from the string.
|
||||
* @throws ParseException if the beginning of the specified string
|
||||
* cannot be parsed.
|
||||
*/
|
||||
|
@ -427,26 +427,26 @@ public abstract class DateFormat extends Format {
|
|||
public abstract Date parse(String source, ParsePosition pos);
|
||||
|
||||
/**
|
||||
* Parses text from a string to produce a <code>Date</code>.
|
||||
* Parses text from a string to produce a {@code Date}.
|
||||
* <p>
|
||||
* The method attempts to parse text starting at the index given by
|
||||
* <code>pos</code>.
|
||||
* If parsing succeeds, then the index of <code>pos</code> is updated
|
||||
* {@code pos}.
|
||||
* If parsing succeeds, then the index of {@code pos} is updated
|
||||
* to the index after the last character used (parsing does not necessarily
|
||||
* use all characters up to the end of the string), and the parsed
|
||||
* date is returned. The updated <code>pos</code> can be used to
|
||||
* date is returned. The updated {@code pos} can be used to
|
||||
* indicate the starting point for the next call to this method.
|
||||
* If an error occurs, then the index of <code>pos</code> is not
|
||||
* changed, the error index of <code>pos</code> is set to the index of
|
||||
* If an error occurs, then the index of {@code pos} is not
|
||||
* changed, the error index of {@code pos} is set to the index of
|
||||
* the character where the error occurred, and null is returned.
|
||||
* <p>
|
||||
* See the {@link #parse(String, ParsePosition)} method for more information
|
||||
* on date parsing.
|
||||
*
|
||||
* @param source A <code>String</code>, part of which should be parsed.
|
||||
* @param pos A <code>ParsePosition</code> object with index and error
|
||||
* @param source A {@code String}, part of which should be parsed.
|
||||
* @param pos A {@code ParsePosition} object with index and error
|
||||
* index information as described above.
|
||||
* @return A <code>Date</code> parsed from the string. In case of
|
||||
* @return A {@code Date} parsed from the string. In case of
|
||||
* error, returns null.
|
||||
* @throws NullPointerException if {@code source} or {@code pos} is null.
|
||||
*/
|
||||
|
@ -628,16 +628,16 @@ public abstract class DateFormat extends Format {
|
|||
|
||||
/**
|
||||
* Returns an array of all locales for which the
|
||||
* <code>get*Instance</code> methods of this class can return
|
||||
* {@code get*Instance} methods of this class can return
|
||||
* localized instances.
|
||||
* The returned array represents the union of locales supported by the Java
|
||||
* runtime and by installed
|
||||
* {@link java.text.spi.DateFormatProvider DateFormatProvider} implementations.
|
||||
* It must contain at least a <code>Locale</code> instance equal to
|
||||
* It must contain at least a {@code Locale} instance equal to
|
||||
* {@link java.util.Locale#US Locale.US}.
|
||||
*
|
||||
* @return An array of locales for which localized
|
||||
* <code>DateFormat</code> instances are available.
|
||||
* {@code DateFormat} instances are available.
|
||||
*/
|
||||
public static Locale[] getAvailableLocales()
|
||||
{
|
||||
|
@ -854,9 +854,9 @@ public abstract class DateFormat extends Format {
|
|||
|
||||
/**
|
||||
* Defines constants that are used as attribute keys in the
|
||||
* <code>AttributedCharacterIterator</code> returned
|
||||
* from <code>DateFormat.formatToCharacterIterator</code> and as
|
||||
* field identifiers in <code>FieldPosition</code>.
|
||||
* {@code AttributedCharacterIterator} returned
|
||||
* from {@code DateFormat.formatToCharacterIterator} and as
|
||||
* field identifiers in {@code FieldPosition}.
|
||||
* <p>
|
||||
* The class also provides two methods to map
|
||||
* between its constants and the corresponding Calendar constants.
|
||||
|
@ -881,13 +881,13 @@ public abstract class DateFormat extends Format {
|
|||
private int calendarField;
|
||||
|
||||
/**
|
||||
* Returns the <code>Field</code> constant that corresponds to
|
||||
* the <code>Calendar</code> constant <code>calendarField</code>.
|
||||
* If there is no direct mapping between the <code>Calendar</code>
|
||||
* constant and a <code>Field</code>, null is returned.
|
||||
* Returns the {@code Field} constant that corresponds to
|
||||
* the {@code Calendar} constant {@code calendarField}.
|
||||
* If there is no direct mapping between the {@code Calendar}
|
||||
* constant and a {@code Field}, null is returned.
|
||||
*
|
||||
* @throws IllegalArgumentException if <code>calendarField</code> is
|
||||
* not the value of a <code>Calendar</code> field constant.
|
||||
* @throws IllegalArgumentException if {@code calendarField} is
|
||||
* not the value of a {@code Calendar} field constant.
|
||||
* @param calendarField Calendar field constant
|
||||
* @return Field instance representing calendarField.
|
||||
* @see java.util.Calendar
|
||||
|
@ -902,14 +902,14 @@ public abstract class DateFormat extends Format {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a <code>Field</code>.
|
||||
* Creates a {@code Field}.
|
||||
*
|
||||
* @param name the name of the <code>Field</code>
|
||||
* @param calendarField the <code>Calendar</code> constant this
|
||||
* <code>Field</code> corresponds to; any value, even one
|
||||
* outside the range of legal <code>Calendar</code> values may
|
||||
* be used, but <code>-1</code> should be used for values
|
||||
* that don't correspond to legal <code>Calendar</code> values
|
||||
* @param name the name of the {@code Field}
|
||||
* @param calendarField the {@code Calendar} constant this
|
||||
* {@code Field} corresponds to; any value, even one
|
||||
* outside the range of legal {@code Calendar} values may
|
||||
* be used, but {@code -1} should be used for values
|
||||
* that don't correspond to legal {@code Calendar} values
|
||||
*/
|
||||
protected Field(String name, int calendarField) {
|
||||
super(name);
|
||||
|
@ -924,11 +924,11 @@ public abstract class DateFormat extends Format {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>Calendar</code> field associated with this
|
||||
* Returns the {@code Calendar} field associated with this
|
||||
* attribute. For example, if this represents the hours field of
|
||||
* a <code>Calendar</code>, this would return
|
||||
* <code>Calendar.HOUR</code>. If there is no corresponding
|
||||
* <code>Calendar</code> constant, this will return -1.
|
||||
* a {@code Calendar}, this would return
|
||||
* {@code Calendar.HOUR}. If there is no corresponding
|
||||
* {@code Calendar} constant, this will return -1.
|
||||
*
|
||||
* @return Calendar constant for this field
|
||||
* @see java.util.Calendar
|
||||
|
|
|
@ -56,22 +56,22 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
|
|||
import sun.util.locale.provider.TimeZoneNameUtility;
|
||||
|
||||
/**
|
||||
* <code>DateFormatSymbols</code> is a public class for encapsulating
|
||||
* {@code DateFormatSymbols} is a public class for encapsulating
|
||||
* localizable date-time formatting data, such as the names of the
|
||||
* months, the names of the days of the week, and the time zone data.
|
||||
* <code>SimpleDateFormat</code> uses
|
||||
* <code>DateFormatSymbols</code> to encapsulate this information.
|
||||
* {@code SimpleDateFormat} uses
|
||||
* {@code DateFormatSymbols} to encapsulate this information.
|
||||
*
|
||||
* <p>
|
||||
* Typically you shouldn't use <code>DateFormatSymbols</code> directly.
|
||||
* Typically you shouldn't use {@code DateFormatSymbols} directly.
|
||||
* Rather, you are encouraged to create a date-time formatter with the
|
||||
* <code>DateFormat</code> class's factory methods: <code>getTimeInstance</code>,
|
||||
* <code>getDateInstance</code>, or <code>getDateTimeInstance</code>.
|
||||
* These methods automatically create a <code>DateFormatSymbols</code> for
|
||||
* {@code DateFormat} class's factory methods: {@code getTimeInstance},
|
||||
* {@code getDateInstance}, or {@code getDateTimeInstance}.
|
||||
* These methods automatically create a {@code DateFormatSymbols} for
|
||||
* the formatter so that you don't have to. After the
|
||||
* formatter is created, you may modify its format pattern using the
|
||||
* <code>setPattern</code> method. For more information about
|
||||
* creating formatters using <code>DateFormat</code>'s factory methods,
|
||||
* {@code setPattern} method. For more information about
|
||||
* creating formatters using {@code DateFormat}'s factory methods,
|
||||
* see {@link DateFormat}.
|
||||
*
|
||||
* <p>
|
||||
|
@ -88,16 +88,16 @@ import sun.util.locale.provider.TimeZoneNameUtility;
|
|||
* the symbols are overridden for the designated region.
|
||||
*
|
||||
* <p>
|
||||
* <code>DateFormatSymbols</code> objects are cloneable. When you obtain
|
||||
* a <code>DateFormatSymbols</code> object, feel free to modify the
|
||||
* {@code DateFormatSymbols} objects are cloneable. When you obtain
|
||||
* a {@code DateFormatSymbols} object, feel free to modify the
|
||||
* date-time formatting data. For instance, you can replace the localized
|
||||
* date-time format pattern characters with the ones that you feel easy
|
||||
* to remember. Or you can change the representative cities
|
||||
* to your favorite ones.
|
||||
*
|
||||
* <p>
|
||||
* New <code>DateFormatSymbols</code> subclasses may be added to support
|
||||
* <code>SimpleDateFormat</code> for date-time formatting for additional locales.
|
||||
* New {@code DateFormatSymbols} subclasses may be added to support
|
||||
* {@code SimpleDateFormat} for date-time formatting for additional locales.
|
||||
|
||||
* @see DateFormat
|
||||
* @see SimpleDateFormat
|
||||
|
@ -159,7 +159,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
|
||||
/**
|
||||
* Era strings. For example: "AD" and "BC". An array of 2 strings,
|
||||
* indexed by <code>Calendar.BC</code> and <code>Calendar.AD</code>.
|
||||
* indexed by {@code Calendar.BC} and {@code Calendar.AD}.
|
||||
* @serial
|
||||
*/
|
||||
String eras[] = null;
|
||||
|
@ -167,7 +167,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
/**
|
||||
* Month strings. For example: "January", "February", etc. An array
|
||||
* of 13 strings (some calendars have 13 months), indexed by
|
||||
* <code>Calendar.JANUARY</code>, <code>Calendar.FEBRUARY</code>, etc.
|
||||
* {@code Calendar.JANUARY}, {@code Calendar.FEBRUARY}, etc.
|
||||
* @serial
|
||||
*/
|
||||
String months[] = null;
|
||||
|
@ -175,7 +175,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
/**
|
||||
* Short month strings. For example: "Jan", "Feb", etc. An array of
|
||||
* 13 strings (some calendars have 13 months), indexed by
|
||||
* <code>Calendar.JANUARY</code>, <code>Calendar.FEBRUARY</code>, etc.
|
||||
* {@code Calendar.JANUARY}, {@code Calendar.FEBRUARY}, etc.
|
||||
|
||||
* @serial
|
||||
*/
|
||||
|
@ -183,26 +183,26 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
|
||||
/**
|
||||
* Weekday strings. For example: "Sunday", "Monday", etc. An array
|
||||
* of 8 strings, indexed by <code>Calendar.SUNDAY</code>,
|
||||
* <code>Calendar.MONDAY</code>, etc.
|
||||
* The element <code>weekdays[0]</code> is ignored.
|
||||
* of 8 strings, indexed by {@code Calendar.SUNDAY},
|
||||
* {@code Calendar.MONDAY}, etc.
|
||||
* The element {@code weekdays[0]} is ignored.
|
||||
* @serial
|
||||
*/
|
||||
String weekdays[] = null;
|
||||
|
||||
/**
|
||||
* Short weekday strings. For example: "Sun", "Mon", etc. An array
|
||||
* of 8 strings, indexed by <code>Calendar.SUNDAY</code>,
|
||||
* <code>Calendar.MONDAY</code>, etc.
|
||||
* The element <code>shortWeekdays[0]</code> is ignored.
|
||||
* of 8 strings, indexed by {@code Calendar.SUNDAY},
|
||||
* {@code Calendar.MONDAY}, etc.
|
||||
* The element {@code shortWeekdays[0]} is ignored.
|
||||
* @serial
|
||||
*/
|
||||
String shortWeekdays[] = null;
|
||||
|
||||
/**
|
||||
* AM and PM strings. For example: "AM" and "PM". An array of
|
||||
* 2 strings, indexed by <code>Calendar.AM</code> and
|
||||
* <code>Calendar.PM</code>.
|
||||
* 2 strings, indexed by {@code Calendar.AM} and
|
||||
* {@code Calendar.PM}.
|
||||
* @serial
|
||||
*/
|
||||
String ampms[] = null;
|
||||
|
@ -211,18 +211,18 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
* Localized names of time zones in this locale. This is a
|
||||
* two-dimensional array of strings of size <em>n</em> by <em>m</em>,
|
||||
* where <em>m</em> is at least 5. Each of the <em>n</em> rows is an
|
||||
* entry containing the localized names for a single <code>TimeZone</code>.
|
||||
* Each such row contains (with <code>i</code> ranging from
|
||||
* entry containing the localized names for a single {@code TimeZone}.
|
||||
* Each such row contains (with {@code i} ranging from
|
||||
* 0..<em>n</em>-1):
|
||||
* <ul>
|
||||
* <li><code>zoneStrings[i][0]</code> - time zone ID</li>
|
||||
* <li><code>zoneStrings[i][1]</code> - long name of zone in standard
|
||||
* <li>{@code zoneStrings[i][0]} - time zone ID</li>
|
||||
* <li>{@code zoneStrings[i][1]} - long name of zone in standard
|
||||
* time</li>
|
||||
* <li><code>zoneStrings[i][2]</code> - short name of zone in
|
||||
* <li>{@code zoneStrings[i][2]} - short name of zone in
|
||||
* standard time</li>
|
||||
* <li><code>zoneStrings[i][3]</code> - long name of zone in daylight
|
||||
* <li>{@code zoneStrings[i][3]} - long name of zone in daylight
|
||||
* saving time</li>
|
||||
* <li><code>zoneStrings[i][4]</code> - short name of zone in daylight
|
||||
* <li>{@code zoneStrings[i][4]} - short name of zone in daylight
|
||||
* saving time</li>
|
||||
* </ul>
|
||||
* The zone ID is <em>not</em> localized; it's one of the valid IDs of
|
||||
|
@ -274,8 +274,8 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
* wish to use 'u' rather than 'y' to represent years in its date format
|
||||
* pattern strings.
|
||||
* This string must be exactly 18 characters long, with the index of
|
||||
* the characters described by <code>DateFormat.ERA_FIELD</code>,
|
||||
* <code>DateFormat.YEAR_FIELD</code>, etc. Thus, if the string were
|
||||
* the characters described by {@code DateFormat.ERA_FIELD},
|
||||
* {@code DateFormat.YEAR_FIELD}, etc. Thus, if the string were
|
||||
* "Xz...", then localized patterns would use 'X' for era and 'z' for year.
|
||||
* @serial
|
||||
*/
|
||||
|
@ -295,16 +295,16 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
|
||||
/**
|
||||
* Returns an array of all locales for which the
|
||||
* <code>getInstance</code> methods of this class can return
|
||||
* {@code getInstance} methods of this class can return
|
||||
* localized instances.
|
||||
* The returned array represents the union of locales supported by the
|
||||
* Java runtime and by installed
|
||||
* {@link java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider}
|
||||
* implementations. It must contain at least a <code>Locale</code>
|
||||
* implementations. It must contain at least a {@code Locale}
|
||||
* instance equal to {@link java.util.Locale#US Locale.US}.
|
||||
*
|
||||
* @return An array of locales for which localized
|
||||
* <code>DateFormatSymbols</code> instances are available.
|
||||
* {@code DateFormatSymbols} instances are available.
|
||||
* @since 1.6
|
||||
*/
|
||||
public static Locale[] getAvailableLocales() {
|
||||
|
@ -314,8 +314,8 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the <code>DateFormatSymbols</code> instance for the default
|
||||
* locale. This method provides access to <code>DateFormatSymbols</code>
|
||||
* Gets the {@code DateFormatSymbols} instance for the default
|
||||
* locale. This method provides access to {@code DateFormatSymbols}
|
||||
* instances for locales supported by the Java runtime itself as well
|
||||
* as for those supported by installed
|
||||
* {@link java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider}
|
||||
|
@ -324,7 +324,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
* getInstance(Locale.getDefault(Locale.Category.FORMAT))}.
|
||||
* @see java.util.Locale#getDefault(java.util.Locale.Category)
|
||||
* @see java.util.Locale.Category#FORMAT
|
||||
* @return a <code>DateFormatSymbols</code> instance.
|
||||
* @return a {@code DateFormatSymbols} instance.
|
||||
* @since 1.6
|
||||
*/
|
||||
public static final DateFormatSymbols getInstance() {
|
||||
|
@ -332,15 +332,15 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the <code>DateFormatSymbols</code> instance for the specified
|
||||
* locale. This method provides access to <code>DateFormatSymbols</code>
|
||||
* Gets the {@code DateFormatSymbols} instance for the specified
|
||||
* locale. This method provides access to {@code DateFormatSymbols}
|
||||
* instances for locales supported by the Java runtime itself as well
|
||||
* as for those supported by installed
|
||||
* {@link java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider}
|
||||
* implementations.
|
||||
* @param locale the given locale.
|
||||
* @return a <code>DateFormatSymbols</code> instance.
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @return a {@code DateFormatSymbols} instance.
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
* @since 1.6
|
||||
*/
|
||||
public static final DateFormatSymbols getInstance(Locale locale) {
|
||||
|
@ -538,18 +538,18 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
* The value returned is a
|
||||
* two-dimensional array of strings of size <em>n</em> by <em>m</em>,
|
||||
* where <em>m</em> is at least 5. Each of the <em>n</em> rows is an
|
||||
* entry containing the localized names for a single <code>TimeZone</code>.
|
||||
* Each such row contains (with <code>i</code> ranging from
|
||||
* entry containing the localized names for a single {@code TimeZone}.
|
||||
* Each such row contains (with {@code i} ranging from
|
||||
* 0..<em>n</em>-1):
|
||||
* <ul>
|
||||
* <li><code>zoneStrings[i][0]</code> - time zone ID</li>
|
||||
* <li><code>zoneStrings[i][1]</code> - long name of zone in standard
|
||||
* <li>{@code zoneStrings[i][0]} - time zone ID</li>
|
||||
* <li>{@code zoneStrings[i][1]} - long name of zone in standard
|
||||
* time</li>
|
||||
* <li><code>zoneStrings[i][2]</code> - short name of zone in
|
||||
* <li>{@code zoneStrings[i][2]} - short name of zone in
|
||||
* standard time</li>
|
||||
* <li><code>zoneStrings[i][3]</code> - long name of zone in daylight
|
||||
* <li>{@code zoneStrings[i][3]} - long name of zone in daylight
|
||||
* saving time</li>
|
||||
* <li><code>zoneStrings[i][4]</code> - short name of zone in daylight
|
||||
* <li>{@code zoneStrings[i][4]} - short name of zone in daylight
|
||||
* saving time</li>
|
||||
* </ul>
|
||||
* The zone ID is <em>not</em> localized; it's one of the valid IDs of
|
||||
|
@ -559,7 +559,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
* daylight saving time, the daylight saving time names should not be used.
|
||||
* <p>
|
||||
* If {@link #setZoneStrings(String[][]) setZoneStrings} has been called
|
||||
* on this <code>DateFormatSymbols</code> instance, then the strings
|
||||
* on this {@code DateFormatSymbols} instance, then the strings
|
||||
* provided by that call are returned. Otherwise, the returned array
|
||||
* contains names provided by the Java runtime and by installed
|
||||
* {@link java.util.spi.TimeZoneNameProvider TimeZoneNameProvider}
|
||||
|
@ -576,18 +576,18 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
* Sets time zone strings. The argument must be a
|
||||
* two-dimensional array of strings of size <em>n</em> by <em>m</em>,
|
||||
* where <em>m</em> is at least 5. Each of the <em>n</em> rows is an
|
||||
* entry containing the localized names for a single <code>TimeZone</code>.
|
||||
* Each such row contains (with <code>i</code> ranging from
|
||||
* entry containing the localized names for a single {@code TimeZone}.
|
||||
* Each such row contains (with {@code i} ranging from
|
||||
* 0..<em>n</em>-1):
|
||||
* <ul>
|
||||
* <li><code>zoneStrings[i][0]</code> - time zone ID</li>
|
||||
* <li><code>zoneStrings[i][1]</code> - long name of zone in standard
|
||||
* <li>{@code zoneStrings[i][0]} - time zone ID</li>
|
||||
* <li>{@code zoneStrings[i][1]} - long name of zone in standard
|
||||
* time</li>
|
||||
* <li><code>zoneStrings[i][2]</code> - short name of zone in
|
||||
* <li>{@code zoneStrings[i][2]} - short name of zone in
|
||||
* standard time</li>
|
||||
* <li><code>zoneStrings[i][3]</code> - long name of zone in daylight
|
||||
* <li>{@code zoneStrings[i][3]} - long name of zone in daylight
|
||||
* saving time</li>
|
||||
* <li><code>zoneStrings[i][4]</code> - short name of zone in daylight
|
||||
* <li>{@code zoneStrings[i][4]} - short name of zone in daylight
|
||||
* saving time</li>
|
||||
* </ul>
|
||||
* The zone ID is <em>not</em> localized; it's one of the valid IDs of
|
||||
|
@ -597,8 +597,8 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
*
|
||||
* @param newZoneStrings the new time zone strings.
|
||||
* @throws IllegalArgumentException if the length of any row in
|
||||
* <code>newZoneStrings</code> is less than 5
|
||||
* @throws NullPointerException if <code>newZoneStrings</code> is null
|
||||
* {@code newZoneStrings} is less than 5
|
||||
* @throws NullPointerException if {@code newZoneStrings} is null
|
||||
* @see #getZoneStrings()
|
||||
*/
|
||||
public void setZoneStrings(String[][] newZoneStrings) {
|
||||
|
@ -888,7 +888,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
|
||||
/**
|
||||
* Write out the default serializable data, after ensuring the
|
||||
* <code>zoneStrings</code> field is initialized in order to make
|
||||
* {@code zoneStrings} field is initialized in order to make
|
||||
* sure the backward compatibility.
|
||||
*
|
||||
* @since 1.6
|
||||
|
|
|
@ -439,7 +439,7 @@ final class DigitList implements Cloneable {
|
|||
* java.math.RoundingMode class.
|
||||
* [bnf]
|
||||
* @param maximumDigits the number of digits to keep, from 0 to
|
||||
* <code>count-1</code>. If 0, then all digits are rounded away, and
|
||||
* {@code count-1}. If 0, then all digits are rounded away, and
|
||||
* this method returns true if a one should be generated (e.g., formatting
|
||||
* 0.09 with "#.#").
|
||||
* @param alreadyRounded whether or not rounding up has already happened.
|
||||
|
@ -447,7 +447,7 @@ final class DigitList implements Cloneable {
|
|||
* an exact decimal representation of the value.
|
||||
* @throws ArithmeticException if rounding is needed with rounding
|
||||
* mode being set to RoundingMode.UNNECESSARY
|
||||
* @return true if digit <code>maximumDigits-1</code> should be
|
||||
* @return true if digit {@code maximumDigits-1} should be
|
||||
* incremented
|
||||
*/
|
||||
private boolean shouldRoundUp(int maximumDigits,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -39,33 +39,33 @@
|
|||
package java.text;
|
||||
|
||||
/**
|
||||
* <code>FieldPosition</code> is a simple class used by <code>Format</code>
|
||||
* {@code FieldPosition} is a simple class used by {@code Format}
|
||||
* and its subclasses to identify fields in formatted output. Fields can
|
||||
* be identified in two ways:
|
||||
* <ul>
|
||||
* <li>By an integer constant, whose names typically end with
|
||||
* <code>_FIELD</code>. The constants are defined in the various
|
||||
* subclasses of <code>Format</code>.
|
||||
* <li>By a <code>Format.Field</code> constant, see <code>ERA_FIELD</code>
|
||||
* and its friends in <code>DateFormat</code> for an example.
|
||||
* {@code _FIELD}. The constants are defined in the various
|
||||
* subclasses of {@code Format}.
|
||||
* <li>By a {@code Format.Field} constant, see {@code ERA_FIELD}
|
||||
* and its friends in {@code DateFormat} for an example.
|
||||
* </ul>
|
||||
* <p>
|
||||
* <code>FieldPosition</code> keeps track of the position of the
|
||||
* {@code FieldPosition} keeps track of the position of the
|
||||
* field within the formatted output with two indices: the index
|
||||
* of the first character of the field and the index of the last
|
||||
* character of the field.
|
||||
*
|
||||
* <p>
|
||||
* One version of the <code>format</code> method in the various
|
||||
* <code>Format</code> classes requires a <code>FieldPosition</code>
|
||||
* object as an argument. You use this <code>format</code> method
|
||||
* One version of the {@code format} method in the various
|
||||
* {@code Format} classes requires a {@code FieldPosition}
|
||||
* object as an argument. You use this {@code format} method
|
||||
* to perform partial formatting or to get information about the
|
||||
* formatted output (such as the position of a field).
|
||||
*
|
||||
* <p>
|
||||
* If you are interested in the positions of all attributes in the
|
||||
* formatted string use the <code>Format</code> method
|
||||
* <code>formatToCharacterIterator</code>.
|
||||
* formatted string use the {@code Format} method
|
||||
* {@code formatToCharacterIterator}.
|
||||
*
|
||||
* @author Mark Davis
|
||||
* @since 1.1
|
||||
|
@ -113,9 +113,9 @@ public class FieldPosition {
|
|||
|
||||
/**
|
||||
* Creates a FieldPosition object for the given field constant. Fields are
|
||||
* identified by constants defined in the various <code>Format</code>
|
||||
* identified by constants defined in the various {@code Format}
|
||||
* subclasses. This is equivalent to calling
|
||||
* <code>new FieldPosition(attribute, -1)</code>.
|
||||
* {@code new FieldPosition(attribute, -1)}.
|
||||
*
|
||||
* @param attribute Format.Field constant identifying a field
|
||||
* @since 1.4
|
||||
|
@ -125,16 +125,16 @@ public class FieldPosition {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a <code>FieldPosition</code> object for the given field.
|
||||
* Creates a {@code FieldPosition} object for the given field.
|
||||
* The field is identified by an attribute constant from one of the
|
||||
* <code>Field</code> subclasses as well as an integer field ID
|
||||
* defined by the <code>Format</code> subclasses. <code>Format</code>
|
||||
* subclasses that are aware of <code>Field</code> should give precedence
|
||||
* to <code>attribute</code> and ignore <code>fieldID</code> if
|
||||
* <code>attribute</code> is not null. However, older <code>Format</code>
|
||||
* subclasses may not be aware of <code>Field</code> and rely on
|
||||
* <code>fieldID</code>. If the field has no corresponding integer
|
||||
* constant, <code>fieldID</code> should be -1.
|
||||
* {@code Field} subclasses as well as an integer field ID
|
||||
* defined by the {@code Format} subclasses. {@code Format}
|
||||
* subclasses that are aware of {@code Field} should give precedence
|
||||
* to {@code attribute} and ignore {@code fieldID} if
|
||||
* {@code attribute} is not null. However, older {@code Format}
|
||||
* subclasses may not be aware of {@code Field} and rely on
|
||||
* {@code fieldID}. If the field has no corresponding integer
|
||||
* constant, {@code fieldID} should be -1.
|
||||
*
|
||||
* @param attribute Format.Field constant identifying a field
|
||||
* @param fieldID integer constant identifying a field
|
||||
|
@ -147,7 +147,7 @@ public class FieldPosition {
|
|||
|
||||
/**
|
||||
* Returns the field identifier as an attribute constant
|
||||
* from one of the <code>Field</code> subclasses. May return null if
|
||||
* from one of the {@code Field} subclasses. May return null if
|
||||
* the field is specified only by an integer field ID.
|
||||
*
|
||||
* @return Identifier for the field
|
||||
|
@ -206,7 +206,7 @@ public class FieldPosition {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a <code>Format.FieldDelegate</code> instance that is associated
|
||||
* Returns a {@code Format.FieldDelegate} instance that is associated
|
||||
* with the FieldPosition. When the delegate is notified of the same
|
||||
* field the FieldPosition is associated with, the begin/end will be
|
||||
* adjusted.
|
||||
|
@ -258,8 +258,8 @@ public class FieldPosition {
|
|||
|
||||
|
||||
/**
|
||||
* Return true if the receiver wants a <code>Format.Field</code> value and
|
||||
* <code>attribute</code> is equal to it.
|
||||
* Return true if the receiver wants a {@code Format.Field} value and
|
||||
* {@code attribute} is equal to it.
|
||||
*/
|
||||
private boolean matchesField(Format.Field attribute) {
|
||||
if (this.attribute != null) {
|
||||
|
@ -269,9 +269,9 @@ public class FieldPosition {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if the receiver wants a <code>Format.Field</code> value and
|
||||
* <code>attribute</code> is equal to it, or true if the receiver
|
||||
* represents an inteter constant and <code>field</code> equals it.
|
||||
* Return true if the receiver wants a {@code Format.Field} value and
|
||||
* {@code attribute} is equal to it, or true if the receiver
|
||||
* represents an inteter constant and {@code field} equals it.
|
||||
*/
|
||||
private boolean matchesField(Format.Field attribute, int field) {
|
||||
if (this.attribute != null) {
|
||||
|
@ -289,7 +289,7 @@ public class FieldPosition {
|
|||
private class Delegate implements Format.FieldDelegate {
|
||||
/**
|
||||
* Indicates whether the field has been encountered before. If this
|
||||
* is true, and <code>formatted</code> is invoked, the begin/end
|
||||
* is true, and {@code formatted} is invoked, the begin/end
|
||||
* are not updated.
|
||||
*/
|
||||
private boolean encounteredField;
|
||||
|
|
|
@ -41,64 +41,64 @@ package java.text;
|
|||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <code>Format</code> is an abstract base class for formatting locale-sensitive
|
||||
* {@code Format} is an abstract base class for formatting locale-sensitive
|
||||
* information such as dates, messages, and numbers.
|
||||
*
|
||||
* <p>
|
||||
* <code>Format</code> defines the programming interface for formatting
|
||||
* locale-sensitive objects into <code>String</code>s (the
|
||||
* <code>format</code> method) and for parsing <code>String</code>s back
|
||||
* into objects (the <code>parseObject</code> method).
|
||||
* {@code Format} defines the programming interface for formatting
|
||||
* locale-sensitive objects into {@code String}s (the
|
||||
* {@code format} method) and for parsing {@code String}s back
|
||||
* into objects (the {@code parseObject} method).
|
||||
*
|
||||
* <p>
|
||||
* Generally, a format's <code>parseObject</code> method must be able to parse
|
||||
* any string formatted by its <code>format</code> method. However, there may
|
||||
* Generally, a format's {@code parseObject} method must be able to parse
|
||||
* any string formatted by its {@code format} method. However, there may
|
||||
* be exceptional cases where this is not possible. For example, a
|
||||
* <code>format</code> method might create two adjacent integer numbers with
|
||||
* no separator in between, and in this case the <code>parseObject</code> could
|
||||
* {@code format} method might create two adjacent integer numbers with
|
||||
* no separator in between, and in this case the {@code parseObject} could
|
||||
* not tell which digits belong to which number.
|
||||
*
|
||||
* <h2>Subclassing</h2>
|
||||
*
|
||||
* <p>
|
||||
* The Java Platform provides three specialized subclasses of <code>Format</code>--
|
||||
* <code>DateFormat</code>, <code>MessageFormat</code>, and
|
||||
* <code>NumberFormat</code>--for formatting dates, messages, and numbers,
|
||||
* The Java Platform provides three specialized subclasses of {@code Format}--
|
||||
* {@code DateFormat}, {@code MessageFormat}, and
|
||||
* {@code NumberFormat}--for formatting dates, messages, and numbers,
|
||||
* respectively.
|
||||
* <p>
|
||||
* Concrete subclasses must implement three methods:
|
||||
* <ol>
|
||||
* <li> <code>format(Object obj, StringBuffer toAppendTo, FieldPosition pos)</code>
|
||||
* <li> <code>formatToCharacterIterator(Object obj)</code>
|
||||
* <li> <code>parseObject(String source, ParsePosition pos)</code>
|
||||
* <li> {@code format(Object obj, StringBuffer toAppendTo, FieldPosition pos)}
|
||||
* <li> {@code formatToCharacterIterator(Object obj)}
|
||||
* <li> {@code parseObject(String source, ParsePosition pos)}
|
||||
* </ol>
|
||||
* These general methods allow polymorphic parsing and formatting of objects
|
||||
* and are used, for example, by <code>MessageFormat</code>.
|
||||
* Subclasses often also provide additional <code>format</code> methods for
|
||||
* specific input types as well as <code>parse</code> methods for specific
|
||||
* result types. Any <code>parse</code> method that does not take a
|
||||
* <code>ParsePosition</code> argument should throw <code>ParseException</code>
|
||||
* and are used, for example, by {@code MessageFormat}.
|
||||
* Subclasses often also provide additional {@code format} methods for
|
||||
* specific input types as well as {@code parse} methods for specific
|
||||
* result types. Any {@code parse} method that does not take a
|
||||
* {@code ParsePosition} argument should throw {@code ParseException}
|
||||
* when no text in the required format is at the beginning of the input text.
|
||||
*
|
||||
* <p>
|
||||
* Most subclasses will also implement the following factory methods:
|
||||
* <ol>
|
||||
* <li>
|
||||
* <code>getInstance</code> for getting a useful format object appropriate
|
||||
* {@code getInstance} for getting a useful format object appropriate
|
||||
* for the current locale
|
||||
* <li>
|
||||
* <code>getInstance(Locale)</code> for getting a useful format
|
||||
* {@code getInstance(Locale)} for getting a useful format
|
||||
* object appropriate for the specified locale
|
||||
* </ol>
|
||||
* In addition, some subclasses may also implement other
|
||||
* <code>getXxxxInstance</code> methods for more specialized control. For
|
||||
* example, the <code>NumberFormat</code> class provides
|
||||
* <code>getPercentInstance</code> and <code>getCurrencyInstance</code>
|
||||
* {@code getXxxxInstance} methods for more specialized control. For
|
||||
* example, the {@code NumberFormat} class provides
|
||||
* {@code getPercentInstance} and {@code getCurrencyInstance}
|
||||
* methods for getting specialized number formatters.
|
||||
*
|
||||
* <p>
|
||||
* Subclasses of <code>Format</code> that allow programmers to create objects
|
||||
* for locales (with <code>getInstance(Locale)</code> for example)
|
||||
* Subclasses of {@code Format} that allow programmers to create objects
|
||||
* for locales (with {@code getInstance(Locale)} for example)
|
||||
* must also implement the following class method:
|
||||
* <blockquote>
|
||||
* <pre>
|
||||
|
@ -112,7 +112,7 @@ import java.io.Serializable;
|
|||
* object which identifies what information is contained in the field and its
|
||||
* position in the formatted result. These constants should be named
|
||||
* <code><em>item</em>_FIELD</code> where <code><em>item</em></code> identifies
|
||||
* the field. For examples of these constants, see <code>ERA_FIELD</code> and its
|
||||
* the field. For examples of these constants, see {@code ERA_FIELD} and its
|
||||
* friends in {@link DateFormat}.
|
||||
*
|
||||
* <h3><a id="synchronization">Synchronization</a></h3>
|
||||
|
@ -162,18 +162,18 @@ public abstract class Format implements Serializable, Cloneable {
|
|||
/**
|
||||
* Formats an object and appends the resulting text to a given string
|
||||
* buffer.
|
||||
* If the <code>pos</code> argument identifies a field used by the format,
|
||||
* If the {@code pos} argument identifies a field used by the format,
|
||||
* then its indices are set to the beginning and end of the first such
|
||||
* field encountered.
|
||||
*
|
||||
* @param obj The object to format
|
||||
* @param toAppendTo where the text is to be appended
|
||||
* @param pos A <code>FieldPosition</code> identifying a field
|
||||
* @param pos A {@code FieldPosition} identifying a field
|
||||
* in the formatted text
|
||||
* @return the string buffer passed in as <code>toAppendTo</code>,
|
||||
* @return the string buffer passed in as {@code toAppendTo},
|
||||
* with formatted text appended
|
||||
* @throws NullPointerException if <code>toAppendTo</code> or
|
||||
* <code>pos</code> is null
|
||||
* @throws NullPointerException if {@code toAppendTo} or
|
||||
* {@code pos} is null
|
||||
* @throws IllegalArgumentException if the Format cannot format the given
|
||||
* object
|
||||
*/
|
||||
|
@ -182,20 +182,20 @@ public abstract class Format implements Serializable, Cloneable {
|
|||
FieldPosition pos);
|
||||
|
||||
/**
|
||||
* Formats an Object producing an <code>AttributedCharacterIterator</code>.
|
||||
* You can use the returned <code>AttributedCharacterIterator</code>
|
||||
* Formats an Object producing an {@code AttributedCharacterIterator}.
|
||||
* You can use the returned {@code AttributedCharacterIterator}
|
||||
* to build the resulting String, as well as to determine information
|
||||
* about the resulting String.
|
||||
* <p>
|
||||
* Each attribute key of the AttributedCharacterIterator will be of type
|
||||
* <code>Field</code>. It is up to each <code>Format</code> implementation
|
||||
* {@code Field}. It is up to each {@code Format} implementation
|
||||
* to define what the legal values are for each attribute in the
|
||||
* <code>AttributedCharacterIterator</code>, but typically the attribute
|
||||
* {@code AttributedCharacterIterator}, but typically the attribute
|
||||
* key is also used as the attribute value.
|
||||
* <p>The default implementation creates an
|
||||
* <code>AttributedCharacterIterator</code> with no attributes. Subclasses
|
||||
* {@code AttributedCharacterIterator} with no attributes. Subclasses
|
||||
* that support fields should override this and create an
|
||||
* <code>AttributedCharacterIterator</code> with meaningful attributes.
|
||||
* {@code AttributedCharacterIterator} with meaningful attributes.
|
||||
*
|
||||
* @throws NullPointerException if obj is null.
|
||||
* @throws IllegalArgumentException when the Format cannot format the
|
||||
|
@ -212,20 +212,20 @@ public abstract class Format implements Serializable, Cloneable {
|
|||
* Parses text from a string to produce an object.
|
||||
* <p>
|
||||
* The method attempts to parse text starting at the index given by
|
||||
* <code>pos</code>.
|
||||
* If parsing succeeds, then the index of <code>pos</code> is updated
|
||||
* {@code pos}.
|
||||
* If parsing succeeds, then the index of {@code pos} is updated
|
||||
* to the index after the last character used (parsing does not necessarily
|
||||
* use all characters up to the end of the string), and the parsed
|
||||
* object is returned. The updated <code>pos</code> can be used to
|
||||
* object is returned. The updated {@code pos} can be used to
|
||||
* indicate the starting point for the next call to this method.
|
||||
* If an error occurs, then the index of <code>pos</code> is not
|
||||
* changed, the error index of <code>pos</code> is set to the index of
|
||||
* If an error occurs, then the index of {@code pos} is not
|
||||
* changed, the error index of {@code pos} is set to the index of
|
||||
* the character where the error occurred, and null is returned.
|
||||
*
|
||||
* @param source A <code>String</code>, part of which should be parsed.
|
||||
* @param pos A <code>ParsePosition</code> object with index and error
|
||||
* @param source A {@code String}, part of which should be parsed.
|
||||
* @param pos A {@code ParsePosition} object with index and error
|
||||
* index information as described above.
|
||||
* @return An <code>Object</code> parsed from the string. In case of
|
||||
* @return An {@code Object} parsed from the string. In case of
|
||||
* error, returns null.
|
||||
* @throws NullPointerException if {@code source} or {@code pos} is null.
|
||||
*/
|
||||
|
@ -235,8 +235,8 @@ public abstract class Format implements Serializable, Cloneable {
|
|||
* Parses text from the beginning of the given string to produce an object.
|
||||
* The method may not use the entire text of the given string.
|
||||
*
|
||||
* @param source A <code>String</code> whose beginning should be parsed.
|
||||
* @return An <code>Object</code> parsed from the string.
|
||||
* @param source A {@code String} whose beginning should be parsed.
|
||||
* @return An {@code Object} parsed from the string.
|
||||
* @throws ParseException if the beginning of the specified string
|
||||
* cannot be parsed.
|
||||
* @throws NullPointerException if {@code source} is null.
|
||||
|
@ -271,8 +271,8 @@ public abstract class Format implements Serializable, Cloneable {
|
|||
//
|
||||
|
||||
/**
|
||||
* Creates an <code>AttributedCharacterIterator</code> for the String
|
||||
* <code>s</code>.
|
||||
* Creates an {@code AttributedCharacterIterator} for the String
|
||||
* {@code s}.
|
||||
*
|
||||
* @param s String to create AttributedCharacterIterator from
|
||||
* @return AttributedCharacterIterator wrapping s
|
||||
|
@ -284,9 +284,9 @@ public abstract class Format implements Serializable, Cloneable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates an <code>AttributedCharacterIterator</code> containing the
|
||||
* Creates an {@code AttributedCharacterIterator} containing the
|
||||
* concatenated contents of the passed in
|
||||
* <code>AttributedCharacterIterator</code>s.
|
||||
* {@code AttributedCharacterIterator}s.
|
||||
*
|
||||
* @param iterators AttributedCharacterIterators used to create resulting
|
||||
* AttributedCharacterIterators
|
||||
|
@ -302,8 +302,8 @@ public abstract class Format implements Serializable, Cloneable {
|
|||
|
||||
/**
|
||||
* Returns an AttributedCharacterIterator with the String
|
||||
* <code>string</code> and additional key/value pair <code>key</code>,
|
||||
* <code>value</code>.
|
||||
* {@code string} and additional key/value pair {@code key},
|
||||
* {@code value}.
|
||||
*
|
||||
* @param string String to create AttributedCharacterIterator from
|
||||
* @param key Key for AttributedCharacterIterator
|
||||
|
@ -321,8 +321,8 @@ public abstract class Format implements Serializable, Cloneable {
|
|||
|
||||
/**
|
||||
* Creates an AttributedCharacterIterator with the contents of
|
||||
* <code>iterator</code> and the additional attribute <code>key</code>
|
||||
* <code>value</code>.
|
||||
* {@code iterator} and the additional attribute {@code key}
|
||||
* {@code value}.
|
||||
*
|
||||
* @param iterator Initial AttributedCharacterIterator to add arg to
|
||||
* @param key Key for AttributedCharacterIterator
|
||||
|
@ -341,9 +341,9 @@ public abstract class Format implements Serializable, Cloneable {
|
|||
|
||||
/**
|
||||
* Defines constants that are used as attribute keys in the
|
||||
* <code>AttributedCharacterIterator</code> returned
|
||||
* from <code>Format.formatToCharacterIterator</code> and as
|
||||
* field identifiers in <code>FieldPosition</code>.
|
||||
* {@code AttributedCharacterIterator} returned
|
||||
* from {@code Format.formatToCharacterIterator} and as
|
||||
* field identifiers in {@code FieldPosition}.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
|
@ -365,13 +365,13 @@ public abstract class Format implements Serializable, Cloneable {
|
|||
|
||||
|
||||
/**
|
||||
* FieldDelegate is notified by the various <code>Format</code>
|
||||
* FieldDelegate is notified by the various {@code Format}
|
||||
* implementations as they are formatting the Objects. This allows for
|
||||
* storage of the individual sections of the formatted String for
|
||||
* later use, such as in a <code>FieldPosition</code> or for an
|
||||
* <code>AttributedCharacterIterator</code>.
|
||||
* later use, such as in a {@code FieldPosition} or for an
|
||||
* {@code AttributedCharacterIterator}.
|
||||
* <p>
|
||||
* Delegates should NOT assume that the <code>Format</code> will notify
|
||||
* Delegates should NOT assume that the {@code Format} will notify
|
||||
* the delegate of fields in any particular order.
|
||||
*
|
||||
* @see FieldPosition#getFieldDelegate
|
||||
|
@ -381,7 +381,7 @@ public abstract class Format implements Serializable, Cloneable {
|
|||
/**
|
||||
* Notified when a particular region of the String is formatted. This
|
||||
* method will be invoked if there is no corresponding integer field id
|
||||
* matching <code>attr</code>.
|
||||
* matching {@code attr}.
|
||||
*
|
||||
* @param attr Identifies the field matched
|
||||
* @param value Value associated with the field
|
||||
|
|
|
@ -50,27 +50,27 @@ import java.util.Locale;
|
|||
|
||||
|
||||
/**
|
||||
* <code>MessageFormat</code> provides a means to produce concatenated
|
||||
* {@code MessageFormat} provides a means to produce concatenated
|
||||
* messages in a language-neutral way. Use this to construct messages
|
||||
* displayed for end users.
|
||||
*
|
||||
* <p>
|
||||
* <code>MessageFormat</code> takes a set of objects, formats them, then
|
||||
* {@code MessageFormat} takes a set of objects, formats them, then
|
||||
* inserts the formatted strings into the pattern at the appropriate places.
|
||||
*
|
||||
* <p>
|
||||
* <strong>Note:</strong>
|
||||
* <code>MessageFormat</code> differs from the other <code>Format</code>
|
||||
* classes in that you create a <code>MessageFormat</code> object with one
|
||||
* of its constructors (not with a <code>getInstance</code> style factory
|
||||
* method). The factory methods aren't necessary because <code>MessageFormat</code>
|
||||
* {@code MessageFormat} differs from the other {@code Format}
|
||||
* classes in that you create a {@code MessageFormat} object with one
|
||||
* of its constructors (not with a {@code getInstance} style factory
|
||||
* method). The factory methods aren't necessary because {@code MessageFormat}
|
||||
* itself doesn't implement locale specific behavior. Any locale specific
|
||||
* behavior is defined by the pattern that you provide as well as the
|
||||
* subformats used for inserted arguments.
|
||||
*
|
||||
* <h2><a id="patterns">Patterns and Their Interpretation</a></h2>
|
||||
*
|
||||
* <code>MessageFormat</code> uses patterns of the following form:
|
||||
* {@code MessageFormat} uses patterns of the following form:
|
||||
* <blockquote><pre>
|
||||
* <i>MessageFormatPattern:</i>
|
||||
* <i>String</i>
|
||||
|
@ -102,7 +102,7 @@ import java.util.Locale;
|
|||
* must be represented by doubled single quotes {@code ''} throughout a
|
||||
* <i>String</i>. For example, pattern string <code>"'{''}'"</code> is
|
||||
* interpreted as a sequence of <code>'{</code> (start of quoting and a
|
||||
* left curly brace), <code>''</code> (a single quote), and
|
||||
* left curly brace), {@code ''} (a single quote), and
|
||||
* <code>}'</code> (a right curly brace and end of quoting),
|
||||
* <em>not</em> <code>'{'</code> and <code>'}'</code> (quoted left and
|
||||
* right curly braces): representing string <code>"{'}"</code>,
|
||||
|
@ -228,8 +228,8 @@ import java.util.Locale;
|
|||
* static strings will, of course, be obtained from resource bundles.
|
||||
* Other parameters will be dynamically determined at runtime.
|
||||
* <p>
|
||||
* The first example uses the static method <code>MessageFormat.format</code>,
|
||||
* which internally creates a <code>MessageFormat</code> for one-time use:
|
||||
* The first example uses the static method {@code MessageFormat.format},
|
||||
* which internally creates a {@code MessageFormat} for one-time use:
|
||||
* <blockquote><pre>
|
||||
* int planet = 7;
|
||||
* String event = "a disturbance in the Force";
|
||||
|
@ -244,7 +244,7 @@ import java.util.Locale;
|
|||
* </pre></blockquote>
|
||||
*
|
||||
* <p>
|
||||
* The following example creates a <code>MessageFormat</code> instance that
|
||||
* The following example creates a {@code MessageFormat} instance that
|
||||
* can be used repeatedly:
|
||||
* <blockquote><pre>
|
||||
* int fileCount = 1273;
|
||||
|
@ -256,7 +256,7 @@ import java.util.Locale;
|
|||
*
|
||||
* System.out.println(form.format(testArgs));
|
||||
* </pre></blockquote>
|
||||
* The output with different values for <code>fileCount</code>:
|
||||
* The output with different values for {@code fileCount}:
|
||||
* <blockquote><pre>
|
||||
* The disk "MyDisk" contains 0 file(s).
|
||||
* The disk "MyDisk" contains 1 file(s).
|
||||
|
@ -264,7 +264,7 @@ import java.util.Locale;
|
|||
* </pre></blockquote>
|
||||
*
|
||||
* <p>
|
||||
* For more sophisticated patterns, you can use a <code>ChoiceFormat</code>
|
||||
* For more sophisticated patterns, you can use a {@code ChoiceFormat}
|
||||
* to produce correct forms for singular and plural:
|
||||
* <blockquote><pre>
|
||||
* MessageFormat form = new MessageFormat("The disk \"{1}\" contains {0}.");
|
||||
|
@ -279,7 +279,7 @@ import java.util.Locale;
|
|||
*
|
||||
* System.out.println(form.format(testArgs));
|
||||
* </pre></blockquote>
|
||||
* The output with different values for <code>fileCount</code>:
|
||||
* The output with different values for {@code fileCount}:
|
||||
* <blockquote><pre>
|
||||
* The disk "MyDisk" contains no files.
|
||||
* The disk "MyDisk" contains one file.
|
||||
|
@ -287,7 +287,7 @@ import java.util.Locale;
|
|||
* </pre></blockquote>
|
||||
*
|
||||
* <p>
|
||||
* You can create the <code>ChoiceFormat</code> programmatically, as in the
|
||||
* You can create the {@code ChoiceFormat} programmatically, as in the
|
||||
* above example, or by using a pattern. See {@link ChoiceFormat}
|
||||
* for more information.
|
||||
* <blockquote><pre>{@code
|
||||
|
@ -297,9 +297,9 @@ import java.util.Locale;
|
|||
*
|
||||
* <p>
|
||||
* <strong>Note:</strong> As we see above, the string produced
|
||||
* by a <code>ChoiceFormat</code> in <code>MessageFormat</code> is treated as special;
|
||||
* by a {@code ChoiceFormat} in {@code MessageFormat} is treated as special;
|
||||
* occurrences of '{' are used to indicate subformats, and cause recursion.
|
||||
* If you create both a <code>MessageFormat</code> and <code>ChoiceFormat</code>
|
||||
* If you create both a {@code MessageFormat} and {@code ChoiceFormat}
|
||||
* programmatically (instead of using the string patterns), then be careful not to
|
||||
* produce a format that recurses on itself, which will cause an infinite loop.
|
||||
* <p>
|
||||
|
@ -398,8 +398,8 @@ public class MessageFormat extends Format {
|
|||
* <li>to the {@link #applyPattern applyPattern}
|
||||
* and {@link #toPattern toPattern} methods if format elements specify
|
||||
* a format type and therefore have the subformats created in the
|
||||
* <code>applyPattern</code> method, as well as
|
||||
* <li>to the <code>format</code> and
|
||||
* {@code applyPattern} method, as well as
|
||||
* <li>to the {@code format} and
|
||||
* {@link #formatToCharacterIterator formatToCharacterIterator} methods
|
||||
* if format elements do not specify a format type and therefore have
|
||||
* the subformats created in the formatting methods.
|
||||
|
@ -596,14 +596,14 @@ public class MessageFormat extends Format {
|
|||
|
||||
/**
|
||||
* Sets the formats to use for the values passed into
|
||||
* <code>format</code> methods or returned from <code>parse</code>
|
||||
* methods. The indices of elements in <code>newFormats</code>
|
||||
* {@code format} methods or returned from {@code parse}
|
||||
* methods. The indices of elements in {@code newFormats}
|
||||
* correspond to the argument indices used in the previously set
|
||||
* pattern string.
|
||||
* The order of formats in <code>newFormats</code> thus corresponds to
|
||||
* the order of elements in the <code>arguments</code> array passed
|
||||
* to the <code>format</code> methods or the result array returned
|
||||
* by the <code>parse</code> methods.
|
||||
* The order of formats in {@code newFormats} thus corresponds to
|
||||
* the order of elements in the {@code arguments} array passed
|
||||
* to the {@code format} methods or the result array returned
|
||||
* by the {@code parse} methods.
|
||||
* <p>
|
||||
* If an argument index is used for more than one format element
|
||||
* in the pattern string, then the corresponding new format is used
|
||||
|
@ -611,10 +611,10 @@ public class MessageFormat extends Format {
|
|||
* for any format element in the pattern string, then the
|
||||
* corresponding new format is ignored. If fewer formats are provided
|
||||
* than needed, then only the formats for argument indices less
|
||||
* than <code>newFormats.length</code> are replaced.
|
||||
* than {@code newFormats.length} are replaced.
|
||||
*
|
||||
* @param newFormats the new formats to use
|
||||
* @throws NullPointerException if <code>newFormats</code> is null
|
||||
* @throws NullPointerException if {@code newFormats} is null
|
||||
* @since 1.4
|
||||
*/
|
||||
public void setFormatsByArgumentIndex(Format[] newFormats) {
|
||||
|
@ -629,24 +629,24 @@ public class MessageFormat extends Format {
|
|||
/**
|
||||
* Sets the formats to use for the format elements in the
|
||||
* previously set pattern string.
|
||||
* The order of formats in <code>newFormats</code> corresponds to
|
||||
* The order of formats in {@code newFormats} corresponds to
|
||||
* the order of format elements in the pattern string.
|
||||
* <p>
|
||||
* If more formats are provided than needed by the pattern string,
|
||||
* the remaining ones are ignored. If fewer formats are provided
|
||||
* than needed, then only the first <code>newFormats.length</code>
|
||||
* than needed, then only the first {@code newFormats.length}
|
||||
* formats are replaced.
|
||||
* <p>
|
||||
* Since the order of format elements in a pattern string often
|
||||
* changes during localization, it is generally better to use the
|
||||
* {@link #setFormatsByArgumentIndex setFormatsByArgumentIndex}
|
||||
* method, which assumes an order of formats corresponding to the
|
||||
* order of elements in the <code>arguments</code> array passed to
|
||||
* the <code>format</code> methods or the result array returned by
|
||||
* the <code>parse</code> methods.
|
||||
* order of elements in the {@code arguments} array passed to
|
||||
* the {@code format} methods or the result array returned by
|
||||
* the {@code parse} methods.
|
||||
*
|
||||
* @param newFormats the new formats to use
|
||||
* @throws NullPointerException if <code>newFormats</code> is null
|
||||
* @throws NullPointerException if {@code newFormats} is null
|
||||
*/
|
||||
public void setFormats(Format[] newFormats) {
|
||||
int runsToCopy = newFormats.length;
|
||||
|
@ -663,9 +663,9 @@ public class MessageFormat extends Format {
|
|||
* previously set pattern string that use the given argument
|
||||
* index.
|
||||
* The argument index is part of the format element definition and
|
||||
* represents an index into the <code>arguments</code> array passed
|
||||
* to the <code>format</code> methods or the result array returned
|
||||
* by the <code>parse</code> methods.
|
||||
* represents an index into the {@code arguments} array passed
|
||||
* to the {@code format} methods or the result array returned
|
||||
* by the {@code parse} methods.
|
||||
* <p>
|
||||
* If the argument index is used for more than one format element
|
||||
* in the pattern string, then the new format is used for all such
|
||||
|
@ -711,14 +711,14 @@ public class MessageFormat extends Format {
|
|||
|
||||
/**
|
||||
* Gets the formats used for the values passed into
|
||||
* <code>format</code> methods or returned from <code>parse</code>
|
||||
* {@code format} methods or returned from {@code parse}
|
||||
* methods. The indices of elements in the returned array
|
||||
* correspond to the argument indices used in the previously set
|
||||
* pattern string.
|
||||
* The order of formats in the returned array thus corresponds to
|
||||
* the order of elements in the <code>arguments</code> array passed
|
||||
* to the <code>format</code> methods or the result array returned
|
||||
* by the <code>parse</code> methods.
|
||||
* the order of elements in the {@code arguments} array passed
|
||||
* to the {@code format} methods or the result array returned
|
||||
* by the {@code parse} methods.
|
||||
* <p>
|
||||
* If an argument index is used for more than one format element
|
||||
* in the pattern string, then the format used for the last such
|
||||
|
@ -753,9 +753,9 @@ public class MessageFormat extends Format {
|
|||
* changes during localization, it's generally better to use the
|
||||
* {@link #getFormatsByArgumentIndex getFormatsByArgumentIndex}
|
||||
* method, which assumes an order of formats corresponding to the
|
||||
* order of elements in the <code>arguments</code> array passed to
|
||||
* the <code>format</code> methods or the result array returned by
|
||||
* the <code>parse</code> methods.
|
||||
* order of elements in the {@code arguments} array passed to
|
||||
* the {@code format} methods or the result array returned by
|
||||
* the {@code parse} methods.
|
||||
*
|
||||
* @return the formats used for the format elements in the pattern
|
||||
*/
|
||||
|
@ -766,16 +766,16 @@ public class MessageFormat extends Format {
|
|||
}
|
||||
|
||||
/**
|
||||
* Formats an array of objects and appends the <code>MessageFormat</code>'s
|
||||
* Formats an array of objects and appends the {@code MessageFormat}'s
|
||||
* pattern, with format elements replaced by the formatted objects, to the
|
||||
* provided <code>StringBuffer</code>.
|
||||
* provided {@code StringBuffer}.
|
||||
* <p>
|
||||
* The text substituted for the individual format elements is derived from
|
||||
* the current subformat of the format element and the
|
||||
* <code>arguments</code> element at the format element's argument index
|
||||
* {@code arguments} element at the format element's argument index
|
||||
* as indicated by the first matching line of the following table. An
|
||||
* argument is <i>unavailable</i> if <code>arguments</code> is
|
||||
* <code>null</code> or has fewer than argumentIndex+1 elements.
|
||||
* argument is <i>unavailable</i> if {@code arguments} is
|
||||
* {@code null} or has fewer than argumentIndex+1 elements.
|
||||
*
|
||||
* <table class="plain">
|
||||
* <caption style="display:none">Examples of subformat,argument,and formatted text</caption>
|
||||
|
@ -791,36 +791,36 @@ public class MessageFormat extends Format {
|
|||
* <th scope="row" style="text-weight-normal"><i>unavailable</i>
|
||||
* <td><code>"{" + argumentIndex + "}"</code>
|
||||
* <tr>
|
||||
* <th scope="row" style="text-weight-normal"><code>null</code>
|
||||
* <td><code>"null"</code>
|
||||
* <th scope="row" style="text-weight-normal">{@code null}
|
||||
* <td>{@code "null"}
|
||||
* <tr>
|
||||
* <th scope="row" style="text-weight-normal"><code>instanceof ChoiceFormat</code>
|
||||
* <th scope="row" style="text-weight-normal">{@code instanceof ChoiceFormat}
|
||||
* <th scope="row" style="text-weight-normal"><i>any</i>
|
||||
* <td><code>subformat.format(argument).indexOf('{') >= 0 ?<br>
|
||||
* (new MessageFormat(subformat.format(argument), getLocale())).format(argument) :
|
||||
* subformat.format(argument)</code>
|
||||
* <tr>
|
||||
* <th scope="row" style="text-weight-normal"><code>!= null</code>
|
||||
* <th scope="row" style="text-weight-normal">{@code != null}
|
||||
* <th scope="row" style="text-weight-normal"><i>any</i>
|
||||
* <td><code>subformat.format(argument)</code>
|
||||
* <td>{@code subformat.format(argument)}
|
||||
* <tr>
|
||||
* <th scope="row" style="text-weight-normal" rowspan=4><code>null</code>
|
||||
* <th scope="row" style="text-weight-normal"><code>instanceof Number</code>
|
||||
* <td><code>NumberFormat.getInstance(getLocale()).format(argument)</code>
|
||||
* <th scope="row" style="text-weight-normal" rowspan=4>{@code null}
|
||||
* <th scope="row" style="text-weight-normal">{@code instanceof Number}
|
||||
* <td>{@code NumberFormat.getInstance(getLocale()).format(argument)}
|
||||
* <tr>
|
||||
* <th scope="row" style="text-weight-normal"><code>instanceof Date</code>
|
||||
* <td><code>DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, getLocale()).format(argument)</code>
|
||||
* <th scope="row" style="text-weight-normal">{@code instanceof Date}
|
||||
* <td>{@code DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, getLocale()).format(argument)}
|
||||
* <tr>
|
||||
* <th scope="row" style="text-weight-normal"><code>instanceof String</code>
|
||||
* <td><code>argument</code>
|
||||
* <th scope="row" style="text-weight-normal">{@code instanceof String}
|
||||
* <td>{@code argument}
|
||||
* <tr>
|
||||
* <th scope="row" style="text-weight-normal"><i>any</i>
|
||||
* <td><code>argument.toString()</code>
|
||||
* <td>{@code argument.toString()}
|
||||
* </tbody>
|
||||
* </table>
|
||||
* <p>
|
||||
* If <code>pos</code> is non-null, and refers to
|
||||
* <code>Field.ARGUMENT</code>, the location of the first formatted
|
||||
* If {@code pos} is non-null, and refers to
|
||||
* {@code Field.ARGUMENT}, the location of the first formatted
|
||||
* string will be returned.
|
||||
*
|
||||
* @param arguments an array of objects to be formatted and substituted.
|
||||
|
@ -830,7 +830,7 @@ public class MessageFormat extends Format {
|
|||
* @return the string buffer passed in as {@code result}, with formatted
|
||||
* text appended
|
||||
* @throws IllegalArgumentException if an argument in the
|
||||
* <code>arguments</code> array is not of the type
|
||||
* {@code arguments} array is not of the type
|
||||
* expected by the format element(s) that use it.
|
||||
* @throws NullPointerException if {@code result} is {@code null}
|
||||
*/
|
||||
|
@ -851,7 +851,7 @@ public class MessageFormat extends Format {
|
|||
* @param arguments object(s) to format
|
||||
* @return the formatted string
|
||||
* @throws IllegalArgumentException if the pattern is invalid,
|
||||
* or if an argument in the <code>arguments</code> array
|
||||
* or if an argument in the {@code arguments} array
|
||||
* is not of the type expected by the format element(s)
|
||||
* that use it.
|
||||
* @throws NullPointerException if {@code pattern} is {@code null}
|
||||
|
@ -863,9 +863,9 @@ public class MessageFormat extends Format {
|
|||
|
||||
// Overrides
|
||||
/**
|
||||
* Formats an array of objects and appends the <code>MessageFormat</code>'s
|
||||
* Formats an array of objects and appends the {@code MessageFormat}'s
|
||||
* pattern, with format elements replaced by the formatted objects, to the
|
||||
* provided <code>StringBuffer</code>.
|
||||
* provided {@code StringBuffer}.
|
||||
* This is equivalent to
|
||||
* <blockquote>
|
||||
* <code>{@link #format(java.lang.Object[], java.lang.StringBuffer, java.text.FieldPosition) format}((Object[]) arguments, result, pos)</code>
|
||||
|
@ -876,7 +876,7 @@ public class MessageFormat extends Format {
|
|||
* @param pos keeps track on the position of the first replaced argument
|
||||
* in the output string.
|
||||
* @throws IllegalArgumentException if an argument in the
|
||||
* <code>arguments</code> array is not of the type
|
||||
* {@code arguments} array is not of the type
|
||||
* expected by the format element(s) that use it.
|
||||
* @throws NullPointerException if {@code result} is {@code null}
|
||||
*/
|
||||
|
@ -888,36 +888,36 @@ public class MessageFormat extends Format {
|
|||
|
||||
/**
|
||||
* Formats an array of objects and inserts them into the
|
||||
* <code>MessageFormat</code>'s pattern, producing an
|
||||
* <code>AttributedCharacterIterator</code>.
|
||||
* You can use the returned <code>AttributedCharacterIterator</code>
|
||||
* {@code MessageFormat}'s pattern, producing an
|
||||
* {@code AttributedCharacterIterator}.
|
||||
* You can use the returned {@code AttributedCharacterIterator}
|
||||
* to build the resulting String, as well as to determine information
|
||||
* about the resulting String.
|
||||
* <p>
|
||||
* The text of the returned <code>AttributedCharacterIterator</code> is
|
||||
* The text of the returned {@code AttributedCharacterIterator} is
|
||||
* the same that would be returned by
|
||||
* <blockquote>
|
||||
* <code>{@link #format(java.lang.Object[], java.lang.StringBuffer, java.text.FieldPosition) format}(arguments, new StringBuffer(), null).toString()</code>
|
||||
* </blockquote>
|
||||
* <p>
|
||||
* In addition, the <code>AttributedCharacterIterator</code> contains at
|
||||
* In addition, the {@code AttributedCharacterIterator} contains at
|
||||
* least attributes indicating where text was generated from an
|
||||
* argument in the <code>arguments</code> array. The keys of these attributes are of
|
||||
* type <code>MessageFormat.Field</code>, their values are
|
||||
* <code>Integer</code> objects indicating the index in the <code>arguments</code>
|
||||
* argument in the {@code arguments} array. The keys of these attributes are of
|
||||
* type {@code MessageFormat.Field}, their values are
|
||||
* {@code Integer} objects indicating the index in the {@code arguments}
|
||||
* array of the argument from which the text was generated.
|
||||
* <p>
|
||||
* The attributes/value from the underlying <code>Format</code>
|
||||
* instances that <code>MessageFormat</code> uses will also be
|
||||
* placed in the resulting <code>AttributedCharacterIterator</code>.
|
||||
* The attributes/value from the underlying {@code Format}
|
||||
* instances that {@code MessageFormat} uses will also be
|
||||
* placed in the resulting {@code AttributedCharacterIterator}.
|
||||
* This allows you to not only find where an argument is placed in the
|
||||
* resulting String, but also which fields it contains in turn.
|
||||
*
|
||||
* @param arguments an array of objects to be formatted and substituted.
|
||||
* @return AttributedCharacterIterator describing the formatted value.
|
||||
* @throws NullPointerException if <code>arguments</code> is null.
|
||||
* @throws NullPointerException if {@code arguments} is null.
|
||||
* @throws IllegalArgumentException if an argument in the
|
||||
* <code>arguments</code> array is not of the type
|
||||
* {@code arguments} array is not of the type
|
||||
* expected by the format element(s) that use it.
|
||||
* @since 1.4
|
||||
*/
|
||||
|
@ -1055,8 +1055,8 @@ public class MessageFormat extends Format {
|
|||
* See the {@link #parse(String, ParsePosition)} method for more information
|
||||
* on message parsing.
|
||||
*
|
||||
* @param source A <code>String</code> whose beginning should be parsed.
|
||||
* @return An <code>Object</code> array parsed from the string.
|
||||
* @param source A {@code String} whose beginning should be parsed.
|
||||
* @return An {@code Object} array parsed from the string.
|
||||
* @throws ParseException if the beginning of the specified string
|
||||
* cannot be parsed.
|
||||
*/
|
||||
|
@ -1073,23 +1073,23 @@ public class MessageFormat extends Format {
|
|||
* Parses text from a string to produce an object array.
|
||||
* <p>
|
||||
* The method attempts to parse text starting at the index given by
|
||||
* <code>pos</code>.
|
||||
* If parsing succeeds, then the index of <code>pos</code> is updated
|
||||
* {@code pos}.
|
||||
* If parsing succeeds, then the index of {@code pos} is updated
|
||||
* to the index after the last character used (parsing does not necessarily
|
||||
* use all characters up to the end of the string), and the parsed
|
||||
* object array is returned. The updated <code>pos</code> can be used to
|
||||
* object array is returned. The updated {@code pos} can be used to
|
||||
* indicate the starting point for the next call to this method.
|
||||
* If an error occurs, then the index of <code>pos</code> is not
|
||||
* changed, the error index of <code>pos</code> is set to the index of
|
||||
* If an error occurs, then the index of {@code pos} is not
|
||||
* changed, the error index of {@code pos} is set to the index of
|
||||
* the character where the error occurred, and null is returned.
|
||||
* <p>
|
||||
* See the {@link #parse(String, ParsePosition)} method for more information
|
||||
* on message parsing.
|
||||
*
|
||||
* @param source A <code>String</code>, part of which should be parsed.
|
||||
* @param pos A <code>ParsePosition</code> object with index and error
|
||||
* @param source A {@code String}, part of which should be parsed.
|
||||
* @param pos A {@code ParsePosition} object with index and error
|
||||
* index information as described above.
|
||||
* @return An <code>Object</code> array parsed from the string. In case of
|
||||
* @return An {@code Object} array parsed from the string. In case of
|
||||
* error, returns null.
|
||||
* @throws NullPointerException if {@code pos} is null.
|
||||
*/
|
||||
|
@ -1146,8 +1146,8 @@ public class MessageFormat extends Format {
|
|||
|
||||
/**
|
||||
* Defines constants that are used as attribute keys in the
|
||||
* <code>AttributedCharacterIterator</code> returned
|
||||
* from <code>MessageFormat.formatToCharacterIterator</code>.
|
||||
* {@code AttributedCharacterIterator} returned
|
||||
* from {@code MessageFormat.formatToCharacterIterator}.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
|
@ -1188,9 +1188,9 @@ public class MessageFormat extends Format {
|
|||
|
||||
/**
|
||||
* Constant identifying a portion of a message that was generated
|
||||
* from an argument passed into <code>formatToCharacterIterator</code>.
|
||||
* The value associated with the key will be an <code>Integer</code>
|
||||
* indicating the index in the <code>arguments</code> array of the
|
||||
* from an argument passed into {@code formatToCharacterIterator}.
|
||||
* The value associated with the key will be an {@code Integer}
|
||||
* indicating the index in the {@code arguments} array of the
|
||||
* argument from which the text was generated.
|
||||
*/
|
||||
public static final Field ARGUMENT =
|
||||
|
@ -1237,9 +1237,9 @@ public class MessageFormat extends Format {
|
|||
private int[] argumentNumbers = new int[INITIAL_FORMATS];
|
||||
|
||||
/**
|
||||
* One less than the number of entries in <code>offsets</code>. Can also be thought of
|
||||
* as the index of the highest-numbered element in <code>offsets</code> that is being used.
|
||||
* All of these arrays should have the same number of elements being used as <code>offsets</code>
|
||||
* One less than the number of entries in {@code offsets}. Can also be thought of
|
||||
* as the index of the highest-numbered element in {@code offsets} that is being used.
|
||||
* All of these arrays should have the same number of elements being used as {@code offsets}
|
||||
* does, and so this variable suffices to tell us how many entries are in all of them.
|
||||
* @serial
|
||||
*/
|
||||
|
@ -1254,7 +1254,7 @@ public class MessageFormat extends Format {
|
|||
* the first replaced argument will be set in it.
|
||||
*
|
||||
* @throws IllegalArgumentException if an argument in the
|
||||
* <code>arguments</code> array is not of the type
|
||||
* {@code arguments} array is not of the type
|
||||
* expected by the format element(s) that use it.
|
||||
*/
|
||||
private StringBuffer subformat(Object[] arguments, StringBuffer result,
|
||||
|
@ -1367,7 +1367,7 @@ public class MessageFormat extends Format {
|
|||
|
||||
/**
|
||||
* Convenience method to append all the characters in
|
||||
* <code>iterator</code> to the StringBuffer <code>result</code>.
|
||||
* {@code iterator} to the StringBuffer {@code result}.
|
||||
*/
|
||||
private void append(StringBuffer result, CharacterIterator iterator) {
|
||||
if (iterator.first() != CharacterIterator.DONE) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -40,10 +40,10 @@ package java.text;
|
|||
import sun.text.normalizer.NormalizerBase;
|
||||
|
||||
/**
|
||||
* This class provides the method <code>normalize</code> which transforms Unicode
|
||||
* This class provides the method {@code normalize} which transforms Unicode
|
||||
* text into an equivalent composed or decomposed form, allowing for easier
|
||||
* sorting and searching of text.
|
||||
* The <code>normalize</code> method supports the standard normalization forms
|
||||
* The {@code normalize} method supports the standard normalization forms
|
||||
* described in
|
||||
* <a href="http://www.unicode.org/unicode/reports/tr15/tr15-23.html">
|
||||
* Unicode Standard Annex #15 — Unicode Normalization Forms</a>.
|
||||
|
@ -88,12 +88,12 @@ import sun.text.normalizer.NormalizerBase;
|
|||
* into the corresponding semantic characters. When sorting and searching, you
|
||||
* will often want to use these mappings.
|
||||
* <p>
|
||||
* The <code>normalize</code> method helps solve these problems by transforming
|
||||
* The {@code normalize} method helps solve these problems by transforming
|
||||
* text into the canonical composed and decomposed forms as shown in the first
|
||||
* example above. In addition, you can have it perform compatibility
|
||||
* decompositions so that you can treat compatibility characters the same as
|
||||
* their equivalents.
|
||||
* Finally, the <code>normalize</code> method rearranges accents into the
|
||||
* Finally, the {@code normalize} method rearranges accents into the
|
||||
* proper canonical order, so that you do not have to worry about accent
|
||||
* rearrangement on your own.
|
||||
* <p>
|
||||
|
@ -152,7 +152,7 @@ public final class Normalizer {
|
|||
* {@link java.text.Normalizer.Form#NFKC},
|
||||
* {@link java.text.Normalizer.Form#NFKD}
|
||||
* @return The normalized String
|
||||
* @throws NullPointerException If <code>src</code> or <code>form</code>
|
||||
* @throws NullPointerException If {@code src} or {@code form}
|
||||
* is null.
|
||||
*/
|
||||
public static String normalize(CharSequence src, Form form) {
|
||||
|
@ -169,7 +169,7 @@ public final class Normalizer {
|
|||
* {@link java.text.Normalizer.Form#NFKD}
|
||||
* @return true if the sequence of char values is normalized;
|
||||
* false otherwise.
|
||||
* @throws NullPointerException If <code>src</code> or <code>form</code>
|
||||
* @throws NullPointerException If {@code src} or {@code form}
|
||||
* is null.
|
||||
*/
|
||||
public static boolean isNormalized(CharSequence src, Form form) {
|
||||
|
|
|
@ -56,13 +56,13 @@ import sun.util.locale.provider.LocaleProviderAdapter;
|
|||
import sun.util.locale.provider.LocaleServiceProviderPool;
|
||||
|
||||
/**
|
||||
* <code>NumberFormat</code> is the abstract base class for all number
|
||||
* {@code NumberFormat} is the abstract base class for all number
|
||||
* formats. This class provides the interface for formatting and parsing
|
||||
* numbers. <code>NumberFormat</code> also provides methods for determining
|
||||
* numbers. {@code NumberFormat} also provides methods for determining
|
||||
* which locales have number formats, and what their names are.
|
||||
*
|
||||
* <p>
|
||||
* <code>NumberFormat</code> helps you to format and parse numbers for any locale.
|
||||
* {@code NumberFormat} helps you to format and parse numbers for any locale.
|
||||
* Your code can be completely independent of the locale conventions for
|
||||
* decimal points, thousands-separators, or even the particular decimal
|
||||
* digits used, or whether the number format is even decimal.
|
||||
|
@ -88,7 +88,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
|
|||
* }</pre>
|
||||
* </blockquote>
|
||||
* To format a number for a different Locale, specify it in the
|
||||
* call to <code>getInstance</code>.
|
||||
* call to {@code getInstance}.
|
||||
* <blockquote>
|
||||
* <pre>{@code
|
||||
* NumberFormat nf = NumberFormat.getInstance(Locale.FRENCH);
|
||||
|
@ -107,25 +107,25 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
|
|||
* myNumber = nf.parse(myString);
|
||||
* }</pre>
|
||||
* </blockquote>
|
||||
* Use <code>getInstance</code> or <code>getNumberInstance</code> to get the
|
||||
* normal number format. Use <code>getIntegerInstance</code> to get an
|
||||
* integer number format. Use <code>getCurrencyInstance</code> to get the
|
||||
* Use {@code getInstance} or {@code getNumberInstance} to get the
|
||||
* normal number format. Use {@code getIntegerInstance} to get an
|
||||
* integer number format. Use {@code getCurrencyInstance} to get the
|
||||
* currency number format. Use {@code getCompactNumberInstance} to get the
|
||||
* compact number format to format a number in shorter form. For example,
|
||||
* {@code 2000} can be formatted as {@code "2K"} in
|
||||
* {@link java.util.Locale#US US locale}. Use <code>getPercentInstance</code>
|
||||
* {@link java.util.Locale#US US locale}. Use {@code getPercentInstance}
|
||||
* to get a format for displaying percentages. With this format, a fraction
|
||||
* like 0.53 is displayed as 53%.
|
||||
*
|
||||
* <p>
|
||||
* You can also control the display of numbers with such methods as
|
||||
* <code>setMinimumFractionDigits</code>.
|
||||
* {@code setMinimumFractionDigits}.
|
||||
* If you want even more control over the format or parsing,
|
||||
* or want to give your users more control,
|
||||
* you can try casting the <code>NumberFormat</code> you get from the factory methods
|
||||
* you can try casting the {@code NumberFormat} you get from the factory methods
|
||||
* to a {@code DecimalFormat} or {@code CompactNumberFormat} depending on
|
||||
* the factory method used. This will work for the vast majority of locales;
|
||||
* just remember to put it in a <code>try</code> block in case you encounter
|
||||
* just remember to put it in a {@code try} block in case you encounter
|
||||
* an unusual one.
|
||||
*
|
||||
* <p>
|
||||
|
@ -149,8 +149,8 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
|
|||
* point, use setParseIntegerOnly.
|
||||
*
|
||||
* <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
|
||||
* You can also use forms of the {@code parse} and {@code format}
|
||||
* methods with {@code ParsePosition} and {@code FieldPosition} to
|
||||
* allow you to:
|
||||
* <ul>
|
||||
* <li> progressively parse through pieces of a string
|
||||
|
@ -159,15 +159,15 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
|
|||
* For example, you can align numbers in two ways:
|
||||
* <ol>
|
||||
* <li> If you are using a monospaced font with spacing for alignment,
|
||||
* you can pass the <code>FieldPosition</code> in your format call, with
|
||||
* <code>field</code> = <code>INTEGER_FIELD</code>. On output,
|
||||
* <code>getEndIndex</code> will be set to the offset between the
|
||||
* you can pass the {@code FieldPosition} in your format call, with
|
||||
* {@code field} = {@code INTEGER_FIELD}. On output,
|
||||
* {@code getEndIndex} will be set to the offset between the
|
||||
* last character of the integer and the decimal. Add
|
||||
* (desiredSpaceCount - getEndIndex) spaces at the front of the string.
|
||||
*
|
||||
* <li> If you are using proportional fonts,
|
||||
* instead of padding with spaces, measure the width
|
||||
* of the string in pixels from the start to <code>getEndIndex</code>.
|
||||
* of the string in pixels from the start to {@code getEndIndex}.
|
||||
* Then move the pen by
|
||||
* (desiredPixelWidth - widthToAlignmentPoint) before drawing the text.
|
||||
* It also works where there is no decimal, but possibly additional
|
||||
|
@ -238,17 +238,17 @@ public abstract class NumberFormat extends Format {
|
|||
* <p>
|
||||
* This implementation extracts the number's value using
|
||||
* {@link java.lang.Number#longValue()} for all integral type values that
|
||||
* can be converted to <code>long</code> without loss of information,
|
||||
* including <code>BigInteger</code> values with a
|
||||
* can be converted to {@code long} without loss of information,
|
||||
* including {@code BigInteger} values with a
|
||||
* {@link java.math.BigInteger#bitLength() bit length} of less than 64,
|
||||
* and {@link java.lang.Number#doubleValue()} for all other types. It
|
||||
* then calls
|
||||
* {@link #format(long,java.lang.StringBuffer,java.text.FieldPosition)}
|
||||
* or {@link #format(double,java.lang.StringBuffer,java.text.FieldPosition)}.
|
||||
* This may result in loss of magnitude information and precision for
|
||||
* <code>BigInteger</code> and <code>BigDecimal</code> values.
|
||||
* {@code BigInteger} and {@code BigDecimal} values.
|
||||
* @param number the number to format
|
||||
* @param toAppendTo the <code>StringBuffer</code> to which the formatted
|
||||
* @param toAppendTo the {@code StringBuffer} to which the formatted
|
||||
* text is to be appended
|
||||
* @param pos keeps track on the position of the field within the
|
||||
* returned string. For example, for formatting a number
|
||||
|
@ -258,11 +258,11 @@ public abstract class NumberFormat extends Format {
|
|||
* and end index of {@code fieldPosition} will be set
|
||||
* to 0 and 9, respectively for the output string
|
||||
* {@code 1,234,567.89}.
|
||||
* @return the value passed in as <code>toAppendTo</code>
|
||||
* @throws IllegalArgumentException if <code>number</code> is
|
||||
* null or not an instance of <code>Number</code>.
|
||||
* @throws NullPointerException if <code>toAppendTo</code> or
|
||||
* <code>pos</code> is null
|
||||
* @return the value passed in as {@code toAppendTo}
|
||||
* @throws IllegalArgumentException if {@code number} is
|
||||
* null or not an instance of {@code Number}.
|
||||
* @throws NullPointerException if {@code toAppendTo} or
|
||||
* {@code pos} is null
|
||||
* @throws ArithmeticException if rounding is needed with rounding
|
||||
* mode being set to RoundingMode.UNNECESSARY
|
||||
* @see java.text.FieldPosition
|
||||
|
@ -285,26 +285,26 @@ public abstract class NumberFormat extends Format {
|
|||
}
|
||||
|
||||
/**
|
||||
* Parses text from a string to produce a <code>Number</code>.
|
||||
* Parses text from a string to produce a {@code Number}.
|
||||
* <p>
|
||||
* The method attempts to parse text starting at the index given by
|
||||
* <code>pos</code>.
|
||||
* If parsing succeeds, then the index of <code>pos</code> is updated
|
||||
* {@code pos}.
|
||||
* If parsing succeeds, then the index of {@code pos} is updated
|
||||
* to the index after the last character used (parsing does not necessarily
|
||||
* use all characters up to the end of the string), and the parsed
|
||||
* number is returned. The updated <code>pos</code> can be used to
|
||||
* number is returned. The updated {@code pos} can be used to
|
||||
* indicate the starting point for the next call to this method.
|
||||
* If an error occurs, then the index of <code>pos</code> is not
|
||||
* changed, the error index of <code>pos</code> is set to the index of
|
||||
* If an error occurs, then the index of {@code pos} is not
|
||||
* changed, the error index of {@code pos} is set to the index of
|
||||
* the character where the error occurred, and null is returned.
|
||||
* <p>
|
||||
* See the {@link #parse(String, ParsePosition)} method for more information
|
||||
* on number parsing.
|
||||
*
|
||||
* @param source A <code>String</code>, part of which should be parsed.
|
||||
* @param pos A <code>ParsePosition</code> object with index and error
|
||||
* @param source A {@code String}, part of which should be parsed.
|
||||
* @param pos A {@code ParsePosition} object with index and error
|
||||
* index information as described above.
|
||||
* @return A <code>Number</code> parsed from the string. In case of
|
||||
* @return A {@code Number} parsed from the string. In case of
|
||||
* error, returns null.
|
||||
* @throws NullPointerException if {@code source} or {@code pos} is null.
|
||||
*/
|
||||
|
@ -422,8 +422,8 @@ public abstract class NumberFormat extends Format {
|
|||
* See the {@link #parse(String, ParsePosition)} method for more information
|
||||
* on number parsing.
|
||||
*
|
||||
* @param source A <code>String</code> whose beginning should be parsed.
|
||||
* @return A <code>Number</code> parsed from the string.
|
||||
* @param source A {@code String} whose beginning should be parsed.
|
||||
* @return A {@code Number} parsed from the string.
|
||||
* @throws ParseException if the beginning of the specified string
|
||||
* cannot be parsed.
|
||||
*/
|
||||
|
@ -677,16 +677,16 @@ public abstract class NumberFormat extends Format {
|
|||
|
||||
/**
|
||||
* Returns an array of all locales for which the
|
||||
* <code>get*Instance</code> methods of this class can return
|
||||
* {@code get*Instance} methods of this class can return
|
||||
* localized instances.
|
||||
* The returned array represents the union of locales supported by the Java
|
||||
* runtime and by installed
|
||||
* {@link java.text.spi.NumberFormatProvider NumberFormatProvider} implementations.
|
||||
* It must contain at least a <code>Locale</code> instance equal to
|
||||
* It must contain at least a {@code Locale} instance equal to
|
||||
* {@link java.util.Locale#US Locale.US}.
|
||||
*
|
||||
* @return An array of locales for which localized
|
||||
* <code>NumberFormat</code> instances are available.
|
||||
* {@code NumberFormat} instances are available.
|
||||
*/
|
||||
public static Locale[] getAvailableLocales() {
|
||||
LocaleServiceProviderPool pool =
|
||||
|
@ -888,9 +888,9 @@ public abstract class NumberFormat extends Format {
|
|||
* {@link #setCurrency(java.util.Currency) setCurrency}.
|
||||
* <p>
|
||||
* The default implementation throws
|
||||
* <code>UnsupportedOperationException</code>.
|
||||
* {@code UnsupportedOperationException}.
|
||||
*
|
||||
* @return the currency used by this number format, or <code>null</code>
|
||||
* @return the currency used by this number format, or {@code null}
|
||||
* @throws UnsupportedOperationException if the number format class
|
||||
* doesn't implement currency formatting
|
||||
* @since 1.4
|
||||
|
@ -905,12 +905,12 @@ public abstract class NumberFormat extends Format {
|
|||
* number of fraction digits used by the number format.
|
||||
* <p>
|
||||
* The default implementation throws
|
||||
* <code>UnsupportedOperationException</code>.
|
||||
* {@code UnsupportedOperationException}.
|
||||
*
|
||||
* @param currency the new currency to be used by this number format
|
||||
* @throws UnsupportedOperationException if the number format class
|
||||
* doesn't implement currency formatting
|
||||
* @throws NullPointerException if <code>currency</code> is null
|
||||
* @throws NullPointerException if {@code currency} is null
|
||||
* @since 1.4
|
||||
*/
|
||||
public void setCurrency(Currency currency) {
|
||||
|
@ -926,7 +926,7 @@ public abstract class NumberFormat extends Format {
|
|||
*
|
||||
* @throws UnsupportedOperationException The default implementation
|
||||
* always throws this exception
|
||||
* @return The <code>RoundingMode</code> used for this NumberFormat.
|
||||
* @return The {@code RoundingMode} used for this NumberFormat.
|
||||
* @see #setRoundingMode(RoundingMode)
|
||||
* @since 1.6
|
||||
*/
|
||||
|
@ -943,8 +943,8 @@ public abstract class NumberFormat extends Format {
|
|||
*
|
||||
* @throws UnsupportedOperationException The default implementation
|
||||
* always throws this exception
|
||||
* @throws NullPointerException if <code>roundingMode</code> is null
|
||||
* @param roundingMode The <code>RoundingMode</code> to be used
|
||||
* @throws NullPointerException if {@code roundingMode} is null
|
||||
* @param roundingMode The {@code RoundingMode} to be used
|
||||
* @see #getRoundingMode()
|
||||
* @since 1.6
|
||||
*/
|
||||
|
@ -996,20 +996,20 @@ public abstract class NumberFormat extends Format {
|
|||
/**
|
||||
* First, read in the default serializable data.
|
||||
*
|
||||
* Then, if <code>serialVersionOnStream</code> is less than 1, indicating that
|
||||
* Then, if {@code serialVersionOnStream} is less than 1, indicating that
|
||||
* the stream was written by JDK 1.1,
|
||||
* set the <code>int</code> fields such as <code>maximumIntegerDigits</code>
|
||||
* to be equal to the <code>byte</code> fields such as <code>maxIntegerDigits</code>,
|
||||
* since the <code>int</code> fields were not present in JDK 1.1.
|
||||
* set the {@code int} fields such as {@code maximumIntegerDigits}
|
||||
* to be equal to the {@code byte} fields such as {@code maxIntegerDigits},
|
||||
* since the {@code int} 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.
|
||||
*
|
||||
* <p>If <code>minimumIntegerDigits</code> is greater than
|
||||
* <code>maximumIntegerDigits</code> or <code>minimumFractionDigits</code>
|
||||
* is greater than <code>maximumFractionDigits</code>, then the stream data
|
||||
* is invalid and this method throws an <code>InvalidObjectException</code>.
|
||||
* <p>If {@code minimumIntegerDigits} is greater than
|
||||
* {@code maximumIntegerDigits} or {@code minimumFractionDigits}
|
||||
* is greater than {@code maximumFractionDigits}, then the stream data
|
||||
* is invalid and this method throws an {@code InvalidObjectException}.
|
||||
* In addition, if any of these values is negative, then this method throws
|
||||
* an <code>InvalidObjectException</code>.
|
||||
* an {@code InvalidObjectException}.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
|
@ -1035,9 +1035,9 @@ public abstract class NumberFormat extends Format {
|
|||
|
||||
/**
|
||||
* Write out the default serializable data, after first setting
|
||||
* the <code>byte</code> fields such as <code>maxIntegerDigits</code> to be
|
||||
* equal to the <code>int</code> fields such as <code>maximumIntegerDigits</code>
|
||||
* (or to <code>Byte.MAX_VALUE</code>, whichever is smaller), for compatibility
|
||||
* the {@code byte} fields such as {@code maxIntegerDigits} to be
|
||||
* equal to the {@code int} fields such as {@code maximumIntegerDigits}
|
||||
* (or to {@code Byte.MAX_VALUE}, whichever is smaller), for compatibility
|
||||
* with the JDK 1.1 version of the stream format.
|
||||
*
|
||||
* @since 1.2
|
||||
|
@ -1076,16 +1076,16 @@ public abstract class NumberFormat extends Format {
|
|||
|
||||
/**
|
||||
* The maximum number of digits allowed in the integer portion of a
|
||||
* number. <code>maxIntegerDigits</code> must be greater than or equal to
|
||||
* <code>minIntegerDigits</code>.
|
||||
* number. {@code maxIntegerDigits} must be greater than or equal to
|
||||
* {@code minIntegerDigits}.
|
||||
* <p>
|
||||
* <strong>Note:</strong> This field exists only for serialization
|
||||
* compatibility with JDK 1.1. In Java platform 2 v1.2 and higher, the new
|
||||
* <code>int</code> field <code>maximumIntegerDigits</code> is used instead.
|
||||
* When writing to a stream, <code>maxIntegerDigits</code> is set to
|
||||
* <code>maximumIntegerDigits</code> or <code>Byte.MAX_VALUE</code>,
|
||||
* {@code int} field {@code maximumIntegerDigits} is used instead.
|
||||
* When writing to a stream, {@code maxIntegerDigits} is set to
|
||||
* {@code maximumIntegerDigits} or {@code Byte.MAX_VALUE},
|
||||
* whichever is smaller. When reading from a stream, this field is used
|
||||
* only if <code>serialVersionOnStream</code> is less than 1.
|
||||
* only if {@code serialVersionOnStream} is less than 1.
|
||||
*
|
||||
* @serial
|
||||
* @see #getMaximumIntegerDigits
|
||||
|
@ -1094,16 +1094,16 @@ public abstract class NumberFormat extends Format {
|
|||
|
||||
/**
|
||||
* The minimum number of digits allowed in the integer portion of a
|
||||
* number. <code>minimumIntegerDigits</code> must be less than or equal to
|
||||
* <code>maximumIntegerDigits</code>.
|
||||
* number. {@code minimumIntegerDigits} must be less than or equal to
|
||||
* {@code maximumIntegerDigits}.
|
||||
* <p>
|
||||
* <strong>Note:</strong> This field exists only for serialization
|
||||
* compatibility with JDK 1.1. In Java platform 2 v1.2 and higher, the new
|
||||
* <code>int</code> field <code>minimumIntegerDigits</code> is used instead.
|
||||
* When writing to a stream, <code>minIntegerDigits</code> is set to
|
||||
* <code>minimumIntegerDigits</code> or <code>Byte.MAX_VALUE</code>,
|
||||
* {@code int} field {@code minimumIntegerDigits} is used instead.
|
||||
* When writing to a stream, {@code minIntegerDigits} is set to
|
||||
* {@code minimumIntegerDigits} or {@code Byte.MAX_VALUE},
|
||||
* whichever is smaller. When reading from a stream, this field is used
|
||||
* only if <code>serialVersionOnStream</code> is less than 1.
|
||||
* only if {@code serialVersionOnStream} is less than 1.
|
||||
*
|
||||
* @serial
|
||||
* @see #getMinimumIntegerDigits
|
||||
|
@ -1112,16 +1112,16 @@ public abstract class NumberFormat extends Format {
|
|||
|
||||
/**
|
||||
* The maximum number of digits allowed in the fractional portion of a
|
||||
* number. <code>maximumFractionDigits</code> must be greater than or equal to
|
||||
* <code>minimumFractionDigits</code>.
|
||||
* number. {@code maximumFractionDigits} must be greater than or equal to
|
||||
* {@code minimumFractionDigits}.
|
||||
* <p>
|
||||
* <strong>Note:</strong> This field exists only for serialization
|
||||
* compatibility with JDK 1.1. In Java platform 2 v1.2 and higher, the new
|
||||
* <code>int</code> field <code>maximumFractionDigits</code> is used instead.
|
||||
* When writing to a stream, <code>maxFractionDigits</code> is set to
|
||||
* <code>maximumFractionDigits</code> or <code>Byte.MAX_VALUE</code>,
|
||||
* {@code int} field {@code maximumFractionDigits} is used instead.
|
||||
* When writing to a stream, {@code maxFractionDigits} is set to
|
||||
* {@code maximumFractionDigits} or {@code Byte.MAX_VALUE},
|
||||
* whichever is smaller. When reading from a stream, this field is used
|
||||
* only if <code>serialVersionOnStream</code> is less than 1.
|
||||
* only if {@code serialVersionOnStream} is less than 1.
|
||||
*
|
||||
* @serial
|
||||
* @see #getMaximumFractionDigits
|
||||
|
@ -1130,16 +1130,16 @@ public abstract class NumberFormat extends Format {
|
|||
|
||||
/**
|
||||
* The minimum number of digits allowed in the fractional portion of a
|
||||
* number. <code>minimumFractionDigits</code> must be less than or equal to
|
||||
* <code>maximumFractionDigits</code>.
|
||||
* number. {@code minimumFractionDigits} must be less than or equal to
|
||||
* {@code maximumFractionDigits}.
|
||||
* <p>
|
||||
* <strong>Note:</strong> This field exists only for serialization
|
||||
* compatibility with JDK 1.1. In Java platform 2 v1.2 and higher, the new
|
||||
* <code>int</code> field <code>minimumFractionDigits</code> is used instead.
|
||||
* When writing to a stream, <code>minFractionDigits</code> is set to
|
||||
* <code>minimumFractionDigits</code> or <code>Byte.MAX_VALUE</code>,
|
||||
* {@code int} field {@code minimumFractionDigits} is used instead.
|
||||
* When writing to a stream, {@code minFractionDigits} is set to
|
||||
* {@code minimumFractionDigits} or {@code Byte.MAX_VALUE},
|
||||
* whichever is smaller. When reading from a stream, this field is used
|
||||
* only if <code>serialVersionOnStream</code> is less than 1.
|
||||
* only if {@code serialVersionOnStream} is less than 1.
|
||||
*
|
||||
* @serial
|
||||
* @see #getMinimumFractionDigits
|
||||
|
@ -1158,8 +1158,8 @@ public abstract class NumberFormat extends Format {
|
|||
|
||||
/**
|
||||
* The maximum number of digits allowed in the integer portion of a
|
||||
* number. <code>maximumIntegerDigits</code> must be greater than or equal to
|
||||
* <code>minimumIntegerDigits</code>.
|
||||
* number. {@code maximumIntegerDigits} must be greater than or equal to
|
||||
* {@code minimumIntegerDigits}.
|
||||
*
|
||||
* @serial
|
||||
* @since 1.2
|
||||
|
@ -1169,8 +1169,8 @@ public abstract class NumberFormat extends Format {
|
|||
|
||||
/**
|
||||
* The minimum number of digits allowed in the integer portion of a
|
||||
* number. <code>minimumIntegerDigits</code> must be less than or equal to
|
||||
* <code>maximumIntegerDigits</code>.
|
||||
* number. {@code minimumIntegerDigits} must be less than or equal to
|
||||
* {@code maximumIntegerDigits}.
|
||||
*
|
||||
* @serial
|
||||
* @since 1.2
|
||||
|
@ -1180,8 +1180,8 @@ public abstract class NumberFormat extends Format {
|
|||
|
||||
/**
|
||||
* The maximum number of digits allowed in the fractional portion of a
|
||||
* number. <code>maximumFractionDigits</code> must be greater than or equal to
|
||||
* <code>minimumFractionDigits</code>.
|
||||
* number. {@code maximumFractionDigits} must be greater than or equal to
|
||||
* {@code minimumFractionDigits}.
|
||||
*
|
||||
* @serial
|
||||
* @since 1.2
|
||||
|
@ -1191,8 +1191,8 @@ public abstract class NumberFormat extends Format {
|
|||
|
||||
/**
|
||||
* The minimum number of digits allowed in the fractional portion of a
|
||||
* number. <code>minimumFractionDigits</code> must be less than or equal to
|
||||
* <code>maximumFractionDigits</code>.
|
||||
* number. {@code minimumFractionDigits} must be less than or equal to
|
||||
* {@code maximumFractionDigits}.
|
||||
*
|
||||
* @serial
|
||||
* @since 1.2
|
||||
|
@ -1203,21 +1203,21 @@ public abstract class NumberFormat extends Format {
|
|||
static final int currentSerialVersion = 1;
|
||||
|
||||
/**
|
||||
* Describes the version of <code>NumberFormat</code> present on the stream.
|
||||
* Describes the version of {@code NumberFormat} present on the stream.
|
||||
* Possible values are:
|
||||
* <ul>
|
||||
* <li><b>0</b> (or uninitialized): the JDK 1.1 version of the stream format.
|
||||
* In this version, the <code>int</code> fields such as
|
||||
* <code>maximumIntegerDigits</code> were not present, and the <code>byte</code>
|
||||
* fields such as <code>maxIntegerDigits</code> are used instead.
|
||||
* In this version, the {@code int} fields such as
|
||||
* {@code maximumIntegerDigits} were not present, and the {@code byte}
|
||||
* fields such as {@code maxIntegerDigits} are used instead.
|
||||
*
|
||||
* <li><b>1</b>: the 1.2 version of the stream format. The values of the
|
||||
* <code>byte</code> fields such as <code>maxIntegerDigits</code> are ignored,
|
||||
* and the <code>int</code> fields such as <code>maximumIntegerDigits</code>
|
||||
* {@code byte} fields such as {@code maxIntegerDigits} are ignored,
|
||||
* and the {@code int} fields such as {@code maximumIntegerDigits}
|
||||
* are used instead.
|
||||
* </ul>
|
||||
* When streaming out a <code>NumberFormat</code>, the most recent format
|
||||
* (corresponding to the highest allowable <code>serialVersionOnStream</code>)
|
||||
* When streaming out a {@code NumberFormat}, the most recent format
|
||||
* (corresponding to the highest allowable {@code serialVersionOnStream})
|
||||
* is always written.
|
||||
*
|
||||
* @serial
|
||||
|
@ -1236,9 +1236,9 @@ public abstract class NumberFormat extends Format {
|
|||
//
|
||||
/**
|
||||
* Defines constants that are used as attribute keys in the
|
||||
* <code>AttributedCharacterIterator</code> returned
|
||||
* from <code>NumberFormat.formatToCharacterIterator</code> and as
|
||||
* field identifiers in <code>FieldPosition</code>.
|
||||
* {@code AttributedCharacterIterator} returned
|
||||
* from {@code NumberFormat.formatToCharacterIterator} and as
|
||||
* field identifiers in {@code FieldPosition}.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -40,14 +40,14 @@ package java.text;
|
|||
|
||||
|
||||
/**
|
||||
* <code>ParsePosition</code> is a simple class used by <code>Format</code>
|
||||
* {@code ParsePosition} is a simple class used by {@code Format}
|
||||
* and its subclasses to keep track of the current position during parsing.
|
||||
* The <code>parseObject</code> method in the various <code>Format</code>
|
||||
* classes requires a <code>ParsePosition</code> object as an argument.
|
||||
* The {@code parseObject} method in the various {@code Format}
|
||||
* classes requires a {@code ParsePosition} object as an argument.
|
||||
*
|
||||
* <p>
|
||||
* By design, as you parse through a string with different formats,
|
||||
* you can use the same <code>ParsePosition</code>, since the index parameter
|
||||
* you can use the same {@code ParsePosition}, since the index parameter
|
||||
* records the current position.
|
||||
*
|
||||
* @author Mark Davis
|
||||
|
|
|
@ -43,14 +43,14 @@ import java.util.Vector;
|
|||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* The <code>RuleBasedCollator</code> class is a concrete subclass of
|
||||
* <code>Collator</code> that provides a simple, data-driven, table
|
||||
* The {@code RuleBasedCollator} class is a concrete subclass of
|
||||
* {@code Collator} that provides a simple, data-driven, table
|
||||
* collator. With this class you can create a customized table-based
|
||||
* <code>Collator</code>. <code>RuleBasedCollator</code> maps
|
||||
* {@code Collator}. {@code RuleBasedCollator} maps
|
||||
* characters to sort keys.
|
||||
*
|
||||
* <p>
|
||||
* <code>RuleBasedCollator</code> has the following restrictions
|
||||
* {@code RuleBasedCollator} has the following restrictions
|
||||
* for efficiency (other subclasses may be used for more complex languages) :
|
||||
* <ol>
|
||||
* <li>If a special collation rule controlled by a <modifier> is
|
||||
|
@ -75,7 +75,7 @@ import java.util.Locale;
|
|||
* [0021-002F, 003A-0040, 005B-0060, 007B-007E]). If those
|
||||
* characters are desired, you can put them in single quotes
|
||||
* (e.g. ampersand => '&'). Note that unquoted white space characters
|
||||
* are ignored; e.g. <code>b c</code> is treated as <code>bc</code>.
|
||||
* are ignored; e.g. {@code b c} is treated as {@code bc}.
|
||||
* <LI><strong>Modifier</strong>: There are currently two modifiers that
|
||||
* turn on special collation rules.
|
||||
* <UL>
|
||||
|
@ -146,7 +146,7 @@ import java.util.Locale;
|
|||
*
|
||||
* <p><strong>Normalization and Accents</strong>
|
||||
* <p>
|
||||
* <code>RuleBasedCollator</code> automatically processes its rule table to
|
||||
* {@code RuleBasedCollator} automatically processes its rule table to
|
||||
* include both pre-composed and combining-character versions of
|
||||
* accented characters. Even if the provided rule string contains only
|
||||
* base characters and separate combining accent characters, the pre-composed
|
||||
|
@ -175,8 +175,8 @@ import java.util.Locale;
|
|||
* text-argument) is not already in the sequence.
|
||||
* (e.g. "a < b & e < f")
|
||||
* </UL>
|
||||
* If you produce one of these errors, a <code>RuleBasedCollator</code> throws
|
||||
* a <code>ParseException</code>.
|
||||
* If you produce one of these errors, a {@code RuleBasedCollator} throws
|
||||
* a {@code ParseException}.
|
||||
*
|
||||
* <p><strong>Examples</strong>
|
||||
* <p>Simple: "< a < b < c < d"
|
||||
|
@ -191,9 +191,9 @@ import java.util.Locale;
|
|||
* aa, AA"
|
||||
*
|
||||
* <p>
|
||||
* To create a <code>RuleBasedCollator</code> object with specialized
|
||||
* rules tailored to your needs, you construct the <code>RuleBasedCollator</code>
|
||||
* with the rules contained in a <code>String</code> object. For example:
|
||||
* To create a {@code RuleBasedCollator} object with specialized
|
||||
* rules tailored to your needs, you construct the {@code RuleBasedCollator}
|
||||
* with the rules contained in a {@code String} object. For example:
|
||||
* <blockquote>
|
||||
* <pre>
|
||||
* String simple = "< a< b< c< d";
|
||||
|
@ -218,7 +218,7 @@ import java.util.Locale;
|
|||
* <p>
|
||||
* A new collation rules string can be created by concatenating rules
|
||||
* strings. For example, the rules returned by {@link #getRules()} could
|
||||
* be concatenated to combine multiple <code>RuleBasedCollator</code>s.
|
||||
* be concatenated to combine multiple {@code RuleBasedCollator}s.
|
||||
*
|
||||
* <p>
|
||||
* The following example demonstrates how to change the order of
|
||||
|
@ -350,7 +350,7 @@ public class RuleBasedCollator extends Collator{
|
|||
* than, greater than or equal to another string in a language.
|
||||
* This can be overridden in a subclass.
|
||||
*
|
||||
* @throws NullPointerException if <code>source</code> or <code>target</code> is null.
|
||||
* @throws NullPointerException if {@code source} or {@code target} is null.
|
||||
*/
|
||||
public synchronized int compare(String source, String target)
|
||||
{
|
||||
|
|
|
@ -58,19 +58,19 @@ import sun.util.locale.provider.LocaleProviderAdapter;
|
|||
import sun.util.locale.provider.TimeZoneNameUtility;
|
||||
|
||||
/**
|
||||
* <code>SimpleDateFormat</code> is a concrete class for formatting and
|
||||
* {@code SimpleDateFormat} is a concrete class for formatting and
|
||||
* parsing dates in a locale-sensitive manner. It allows for formatting
|
||||
* (date → text), parsing (text → date), and normalization.
|
||||
*
|
||||
* <p>
|
||||
* <code>SimpleDateFormat</code> allows you to start by choosing
|
||||
* {@code SimpleDateFormat} allows you to start by choosing
|
||||
* any user-defined patterns for date-time formatting. However, you
|
||||
* are encouraged to create a date-time formatter with either
|
||||
* <code>getTimeInstance</code>, <code>getDateInstance</code>, or
|
||||
* <code>getDateTimeInstance</code> in <code>DateFormat</code>. Each
|
||||
* {@code getTimeInstance}, {@code getDateInstance}, or
|
||||
* {@code getDateTimeInstance} in {@code DateFormat}. Each
|
||||
* of these class methods can return a date/time formatter initialized
|
||||
* with a default format pattern. You may modify the format pattern
|
||||
* using the <code>applyPattern</code> methods as desired.
|
||||
* using the {@code applyPattern} methods as desired.
|
||||
* For more information on using these methods, see
|
||||
* {@link DateFormat}.
|
||||
*
|
||||
|
@ -79,19 +79,19 @@ import sun.util.locale.provider.TimeZoneNameUtility;
|
|||
* Date and time formats are specified by <em>date and time pattern</em>
|
||||
* strings.
|
||||
* Within date and time pattern strings, unquoted letters from
|
||||
* <code>'A'</code> to <code>'Z'</code> and from <code>'a'</code> to
|
||||
* <code>'z'</code> are interpreted as pattern letters representing the
|
||||
* {@code 'A'} to {@code 'Z'} and from {@code 'a'} to
|
||||
* {@code 'z'} are interpreted as pattern letters representing the
|
||||
* components of a date or time string.
|
||||
* Text can be quoted using single quotes (<code>'</code>) to avoid
|
||||
* Text can be quoted using single quotes ({@code '}) to avoid
|
||||
* interpretation.
|
||||
* <code>"''"</code> represents a single quote.
|
||||
* {@code "''"} represents a single quote.
|
||||
* All other characters are not interpreted; they're simply copied into the
|
||||
* output string during formatting or matched against the input string
|
||||
* during parsing.
|
||||
* <p>
|
||||
* The following pattern letters are defined (all other characters from
|
||||
* <code>'A'</code> to <code>'Z'</code> and from <code>'a'</code> to
|
||||
* <code>'z'</code> are reserved):
|
||||
* {@code 'A'} to {@code 'Z'} and from {@code 'a'} to
|
||||
* {@code 'z'} are reserved):
|
||||
* <blockquote>
|
||||
* <table class="striped">
|
||||
* <caption style="display:none">Chart shows pattern letters, date/time component, presentation, and examples.</caption>
|
||||
|
@ -104,120 +104,120 @@ import sun.util.locale.provider.TimeZoneNameUtility;
|
|||
* </thead>
|
||||
* <tbody>
|
||||
* <tr>
|
||||
* <th scope="row"><code>G</code>
|
||||
* <th scope="row">{@code G}
|
||||
* <td>Era designator
|
||||
* <td><a href="#text">Text</a>
|
||||
* <td><code>AD</code>
|
||||
* <td>{@code AD}
|
||||
* <tr>
|
||||
* <th scope="row"><code>y</code>
|
||||
* <th scope="row">{@code y}
|
||||
* <td>Year
|
||||
* <td><a href="#year">Year</a>
|
||||
* <td><code>1996</code>; <code>96</code>
|
||||
* <td>{@code 1996}; {@code 96}
|
||||
* <tr>
|
||||
* <th scope="row"><code>Y</code>
|
||||
* <th scope="row">{@code Y}
|
||||
* <td>Week year
|
||||
* <td><a href="#year">Year</a>
|
||||
* <td><code>2009</code>; <code>09</code>
|
||||
* <td>{@code 2009}; {@code 09}
|
||||
* <tr>
|
||||
* <th scope="row"><code>M</code>
|
||||
* <th scope="row">{@code M}
|
||||
* <td>Month in year (context sensitive)
|
||||
* <td><a href="#month">Month</a>
|
||||
* <td><code>July</code>; <code>Jul</code>; <code>07</code>
|
||||
* <td>{@code July}; {@code Jul}; {@code 07}
|
||||
* <tr>
|
||||
* <th scope="row"><code>L</code>
|
||||
* <th scope="row">{@code L}
|
||||
* <td>Month in year (standalone form)
|
||||
* <td><a href="#month">Month</a>
|
||||
* <td><code>July</code>; <code>Jul</code>; <code>07</code>
|
||||
* <td>{@code July}; {@code Jul}; {@code 07}
|
||||
* <tr>
|
||||
* <th scope="row"><code>w</code>
|
||||
* <th scope="row">{@code w}
|
||||
* <td>Week in year
|
||||
* <td><a href="#number">Number</a>
|
||||
* <td><code>27</code>
|
||||
* <td>{@code 27}
|
||||
* <tr>
|
||||
* <th scope="row"><code>W</code>
|
||||
* <th scope="row">{@code W}
|
||||
* <td>Week in month
|
||||
* <td><a href="#number">Number</a>
|
||||
* <td><code>2</code>
|
||||
* <td>{@code 2}
|
||||
* <tr>
|
||||
* <th scope="row"><code>D</code>
|
||||
* <th scope="row">{@code D}
|
||||
* <td>Day in year
|
||||
* <td><a href="#number">Number</a>
|
||||
* <td><code>189</code>
|
||||
* <td>{@code 189}
|
||||
* <tr>
|
||||
* <th scope="row"><code>d</code>
|
||||
* <th scope="row">{@code d}
|
||||
* <td>Day in month
|
||||
* <td><a href="#number">Number</a>
|
||||
* <td><code>10</code>
|
||||
* <td>{@code 10}
|
||||
* <tr>
|
||||
* <th scope="row"><code>F</code>
|
||||
* <th scope="row">{@code F}
|
||||
* <td>Day of week in month
|
||||
* <td><a href="#number">Number</a>
|
||||
* <td><code>2</code>
|
||||
* <td>{@code 2}
|
||||
* <tr>
|
||||
* <th scope="row"><code>E</code>
|
||||
* <th scope="row">{@code E}
|
||||
* <td>Day name in week
|
||||
* <td><a href="#text">Text</a>
|
||||
* <td><code>Tuesday</code>; <code>Tue</code>
|
||||
* <td>{@code Tuesday}; {@code Tue}
|
||||
* <tr>
|
||||
* <th scope="row"><code>u</code>
|
||||
* <th scope="row">{@code u}
|
||||
* <td>Day number of week (1 = Monday, ..., 7 = Sunday)
|
||||
* <td><a href="#number">Number</a>
|
||||
* <td><code>1</code>
|
||||
* <td>{@code 1}
|
||||
* <tr>
|
||||
* <th scope="row"><code>a</code>
|
||||
* <th scope="row">{@code a}
|
||||
* <td>Am/pm marker
|
||||
* <td><a href="#text">Text</a>
|
||||
* <td><code>PM</code>
|
||||
* <td>{@code PM}
|
||||
* <tr>
|
||||
* <th scope="row"><code>H</code>
|
||||
* <th scope="row">{@code H}
|
||||
* <td>Hour in day (0-23)
|
||||
* <td><a href="#number">Number</a>
|
||||
* <td><code>0</code>
|
||||
* <td>{@code 0}
|
||||
* <tr>
|
||||
* <th scope="row"><code>k</code>
|
||||
* <th scope="row">{@code k}
|
||||
* <td>Hour in day (1-24)
|
||||
* <td><a href="#number">Number</a>
|
||||
* <td><code>24</code>
|
||||
* <td>{@code 24}
|
||||
* <tr>
|
||||
* <th scope="row"><code>K</code>
|
||||
* <th scope="row">{@code K}
|
||||
* <td>Hour in am/pm (0-11)
|
||||
* <td><a href="#number">Number</a>
|
||||
* <td><code>0</code>
|
||||
* <td>{@code 0}
|
||||
* <tr>
|
||||
* <th scope="row"><code>h</code>
|
||||
* <th scope="row">{@code h}
|
||||
* <td>Hour in am/pm (1-12)
|
||||
* <td><a href="#number">Number</a>
|
||||
* <td><code>12</code>
|
||||
* <td>{@code 12}
|
||||
* <tr>
|
||||
* <th scope="row"><code>m</code>
|
||||
* <th scope="row">{@code m}
|
||||
* <td>Minute in hour
|
||||
* <td><a href="#number">Number</a>
|
||||
* <td><code>30</code>
|
||||
* <td>{@code 30}
|
||||
* <tr>
|
||||
* <th scope="row"><code>s</code>
|
||||
* <th scope="row">{@code s}
|
||||
* <td>Second in minute
|
||||
* <td><a href="#number">Number</a>
|
||||
* <td><code>55</code>
|
||||
* <td>{@code 55}
|
||||
* <tr>
|
||||
* <th scope="row"><code>S</code>
|
||||
* <th scope="row">{@code S}
|
||||
* <td>Millisecond
|
||||
* <td><a href="#number">Number</a>
|
||||
* <td><code>978</code>
|
||||
* <td>{@code 978}
|
||||
* <tr>
|
||||
* <th scope="row"><code>z</code>
|
||||
* <th scope="row">{@code z}
|
||||
* <td>Time zone
|
||||
* <td><a href="#timezone">General time zone</a>
|
||||
* <td><code>Pacific Standard Time</code>; <code>PST</code>; <code>GMT-08:00</code>
|
||||
* <td>{@code Pacific Standard Time}; {@code PST}; {@code GMT-08:00}
|
||||
* <tr>
|
||||
* <th scope="row"><code>Z</code>
|
||||
* <th scope="row">{@code Z}
|
||||
* <td>Time zone
|
||||
* <td><a href="#rfc822timezone">RFC 822 time zone</a>
|
||||
* <td><code>-0800</code>
|
||||
* <td>{@code -0800}
|
||||
* <tr>
|
||||
* <th scope="row"><code>X</code>
|
||||
* <th scope="row">{@code X}
|
||||
* <td>Time zone
|
||||
* <td><a href="#iso8601timezone">ISO 8601 time zone</a>
|
||||
* <td><code>-08</code>; <code>-0800</code>; <code>-08:00</code>
|
||||
* <td>{@code -08}; {@code -0800}; {@code -08:00}
|
||||
* </tbody>
|
||||
* </table>
|
||||
* </blockquote>
|
||||
|
@ -247,11 +247,11 @@ import sun.util.locale.provider.TimeZoneNameUtility;
|
|||
* digits. So using the pattern "MM/dd/yyyy", "01/11/12" parses to
|
||||
* Jan 11, 12 A.D.
|
||||
* <li>For parsing with the abbreviated year pattern ("y" or "yy"),
|
||||
* <code>SimpleDateFormat</code> must interpret the abbreviated year
|
||||
* {@code SimpleDateFormat} must interpret the abbreviated year
|
||||
* relative to some century. It does this by adjusting dates to be
|
||||
* within 80 years before and 20 years after the time the <code>SimpleDateFormat</code>
|
||||
* within 80 years before and 20 years after the time the {@code SimpleDateFormat}
|
||||
* instance is created. For example, using a pattern of "MM/dd/yy" and a
|
||||
* <code>SimpleDateFormat</code> instance created on Jan 1, 1997, the string
|
||||
* {@code SimpleDateFormat} instance created on Jan 1, 1997, the string
|
||||
* "01/11/12" would be interpreted as Jan 11, 2012 while the string "05/04/64"
|
||||
* would be interpreted as May 4, 1964.
|
||||
* During parsing, only strings consisting of exactly two digits, as defined by
|
||||
|
@ -303,16 +303,16 @@ import sun.util.locale.provider.TimeZoneNameUtility;
|
|||
* following syntax is used:
|
||||
* <pre>
|
||||
* <a id="GMTOffsetTimeZone"><i>GMTOffsetTimeZone:</i></a>
|
||||
* <code>GMT</code> <i>Sign</i> <i>Hours</i> <code>:</code> <i>Minutes</i>
|
||||
* {@code GMT} <i>Sign</i> <i>Hours</i> {@code :} <i>Minutes</i>
|
||||
* <i>Sign:</i> one of
|
||||
* <code>+ -</code>
|
||||
* {@code + -}
|
||||
* <i>Hours:</i>
|
||||
* <i>Digit</i>
|
||||
* <i>Digit</i> <i>Digit</i>
|
||||
* <i>Minutes:</i>
|
||||
* <i>Digit</i> <i>Digit</i>
|
||||
* <i>Digit:</i> one of
|
||||
* <code>0 1 2 3 4 5 6 7 8 9</code></pre>
|
||||
* {@code 0 1 2 3 4 5 6 7 8 9}</pre>
|
||||
* <i>Hours</i> must be between 0 and 23, and <i>Minutes</i> must be between
|
||||
* 00 and 59. The format is locale independent and digits must be taken
|
||||
* from the Basic Latin block of the Unicode standard.
|
||||
|
@ -364,10 +364,10 @@ import sun.util.locale.provider.TimeZoneNameUtility;
|
|||
* SimpleDateFormat} or {@linkplain #applyPattern(String) applying a
|
||||
* pattern}.
|
||||
* </ul>
|
||||
* <code>SimpleDateFormat</code> also supports <em>localized date and time
|
||||
* {@code SimpleDateFormat} also supports <em>localized date and time
|
||||
* pattern</em> strings. In these strings, the pattern letters described above
|
||||
* may be replaced with other, locale dependent, pattern letters.
|
||||
* <code>SimpleDateFormat</code> does not deal with the localization of text
|
||||
* {@code SimpleDateFormat} does not deal with the localization of text
|
||||
* other than the pattern letters; that's up to the client of the class.
|
||||
*
|
||||
* <h3>Examples</h3>
|
||||
|
@ -385,38 +385,38 @@ import sun.util.locale.provider.TimeZoneNameUtility;
|
|||
* </thead>
|
||||
* <tbody>
|
||||
* <tr>
|
||||
* <th scope="row"><code>"yyyy.MM.dd G 'at' HH:mm:ss z"</code>
|
||||
* <td><code>2001.07.04 AD at 12:08:56 PDT</code>
|
||||
* <th scope="row">{@code "yyyy.MM.dd G 'at' HH:mm:ss z"}
|
||||
* <td>{@code 2001.07.04 AD at 12:08:56 PDT}
|
||||
* <tr>
|
||||
* <th scope="row"><code>"EEE, MMM d, ''yy"</code>
|
||||
* <td><code>Wed, Jul 4, '01</code>
|
||||
* <th scope="row">{@code "EEE, MMM d, ''yy"}
|
||||
* <td>{@code Wed, Jul 4, '01}
|
||||
* <tr>
|
||||
* <th scope="row"><code>"h:mm a"</code>
|
||||
* <td><code>12:08 PM</code>
|
||||
* <th scope="row">{@code "h:mm a"}
|
||||
* <td>{@code 12:08 PM}
|
||||
* <tr>
|
||||
* <th scope="row"><code>"hh 'o''clock' a, zzzz"</code>
|
||||
* <td><code>12 o'clock PM, Pacific Daylight Time</code>
|
||||
* <th scope="row">{@code "hh 'o''clock' a, zzzz"}
|
||||
* <td>{@code 12 o'clock PM, Pacific Daylight Time}
|
||||
* <tr>
|
||||
* <th scope="row"><code>"K:mm a, z"</code>
|
||||
* <td><code>0:08 PM, PDT</code>
|
||||
* <th scope="row">{@code "K:mm a, z"}
|
||||
* <td>{@code 0:08 PM, PDT}
|
||||
* <tr>
|
||||
* <th scope="row"><code>"yyyyy.MMMMM.dd GGG hh:mm aaa"</code>
|
||||
* <td><code>02001.July.04 AD 12:08 PM</code>
|
||||
* <th scope="row">{@code "yyyyy.MMMMM.dd GGG hh:mm aaa"}
|
||||
* <td>{@code 02001.July.04 AD 12:08 PM}
|
||||
* <tr>
|
||||
* <th scope="row"><code>"EEE, d MMM yyyy HH:mm:ss Z"</code>
|
||||
* <td><code>Wed, 4 Jul 2001 12:08:56 -0700</code>
|
||||
* <th scope="row">{@code "EEE, d MMM yyyy HH:mm:ss Z"}
|
||||
* <td>{@code Wed, 4 Jul 2001 12:08:56 -0700}
|
||||
* <tr>
|
||||
* <th scope="row"><code>"yyMMddHHmmssZ"</code>
|
||||
* <td><code>010704120856-0700</code>
|
||||
* <th scope="row">{@code "yyMMddHHmmssZ"}
|
||||
* <td>{@code 010704120856-0700}
|
||||
* <tr>
|
||||
* <th scope="row"><code>"yyyy-MM-dd'T'HH:mm:ss.SSSZ"</code>
|
||||
* <td><code>2001-07-04T12:08:56.235-0700</code>
|
||||
* <th scope="row">{@code "yyyy-MM-dd'T'HH:mm:ss.SSSZ"}
|
||||
* <td>{@code 2001-07-04T12:08:56.235-0700}
|
||||
* <tr>
|
||||
* <th scope="row"><code>"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"</code>
|
||||
* <td><code>2001-07-04T12:08:56.235-07:00</code>
|
||||
* <th scope="row">{@code "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"}
|
||||
* <td>{@code 2001-07-04T12:08:56.235-07:00}
|
||||
* <tr>
|
||||
* <th scope="row"><code>"YYYY-'W'ww-u"</code>
|
||||
* <td><code>2001-W27-3</code>
|
||||
* <th scope="row">{@code "YYYY-'W'ww-u"}
|
||||
* <td>{@code 2001-W27-3}
|
||||
* </tbody>
|
||||
* </table>
|
||||
* </blockquote>
|
||||
|
@ -453,12 +453,12 @@ public class SimpleDateFormat extends DateFormat {
|
|||
* The version of the serialized data on the stream. Possible values:
|
||||
* <ul>
|
||||
* <li><b>0</b> or not present on stream: JDK 1.1.3. This version
|
||||
* has no <code>defaultCenturyStart</code> on stream.
|
||||
* has no {@code defaultCenturyStart} on stream.
|
||||
* <li><b>1</b> JDK 1.1.4 or later. This version adds
|
||||
* <code>defaultCenturyStart</code>.
|
||||
* {@code defaultCenturyStart}.
|
||||
* </ul>
|
||||
* When streaming out this class, the most recent format
|
||||
* and the highest allowable <code>serialVersionOnStream</code>
|
||||
* and the highest allowable {@code serialVersionOnStream}
|
||||
* is written.
|
||||
* @serial
|
||||
* @since 1.1.4
|
||||
|
@ -523,7 +523,7 @@ public class SimpleDateFormat extends DateFormat {
|
|||
|
||||
/**
|
||||
* We map dates with two-digit years into the century starting at
|
||||
* <code>defaultCenturyStart</code>, which may be any date. May
|
||||
* {@code defaultCenturyStart}, which may be any date. May
|
||||
* not be null.
|
||||
* @serial
|
||||
* @since 1.1.4
|
||||
|
@ -546,8 +546,8 @@ public class SimpleDateFormat extends DateFormat {
|
|||
|
||||
/**
|
||||
* The Locale used to instantiate this
|
||||
* <code>SimpleDateFormat</code>. The value may be null if this object
|
||||
* has been created by an older <code>SimpleDateFormat</code> and
|
||||
* {@code SimpleDateFormat}. The value may be null if this object
|
||||
* has been created by an older {@code SimpleDateFormat} and
|
||||
* deserialized.
|
||||
*
|
||||
* @serial
|
||||
|
@ -556,7 +556,7 @@ public class SimpleDateFormat extends DateFormat {
|
|||
private Locale locale;
|
||||
|
||||
/**
|
||||
* Indicates whether this <code>SimpleDateFormat</code> should use
|
||||
* Indicates whether this {@code SimpleDateFormat} should use
|
||||
* the DateFormatSymbols. If true, the format and parse methods
|
||||
* use the DateFormatSymbols values. If false, the format and
|
||||
* parse methods call Calendar.getDisplayName or
|
||||
|
@ -565,7 +565,7 @@ public class SimpleDateFormat extends DateFormat {
|
|||
transient boolean useDateFormatSymbols;
|
||||
|
||||
/**
|
||||
* Constructs a <code>SimpleDateFormat</code> using the default pattern and
|
||||
* Constructs a {@code SimpleDateFormat} using the default pattern and
|
||||
* date format symbols for the default
|
||||
* {@link java.util.Locale.Category#FORMAT FORMAT} locale.
|
||||
* <b>Note:</b> This constructor may not support all locales.
|
||||
|
@ -579,7 +579,7 @@ public class SimpleDateFormat extends DateFormat {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a <code>SimpleDateFormat</code> using the given pattern and
|
||||
* Constructs a {@code SimpleDateFormat} using the given pattern and
|
||||
* the default date format symbols for the default
|
||||
* {@link java.util.Locale.Category#FORMAT FORMAT} locale.
|
||||
* <b>Note:</b> This constructor may not support all locales.
|
||||
|
@ -601,7 +601,7 @@ public class SimpleDateFormat extends DateFormat {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a <code>SimpleDateFormat</code> using the given pattern and
|
||||
* Constructs a {@code SimpleDateFormat} using the given pattern and
|
||||
* the default date format symbols for the given locale.
|
||||
* <b>Note:</b> This constructor may not support all locales.
|
||||
* For full coverage, use the factory methods in the {@link DateFormat}
|
||||
|
@ -626,7 +626,7 @@ public class SimpleDateFormat extends DateFormat {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a <code>SimpleDateFormat</code> using the given pattern and
|
||||
* Constructs a {@code SimpleDateFormat} using the given pattern and
|
||||
* date format symbols.
|
||||
*
|
||||
* @param pattern the pattern describing the date and time format
|
||||
|
@ -916,7 +916,7 @@ public class SimpleDateFormat extends DateFormat {
|
|||
* to begin on the date the user specifies.
|
||||
*
|
||||
* @param startDate During parsing, two digit years will be placed in the range
|
||||
* <code>startDate</code> to <code>startDate + 100 years</code>.
|
||||
* {@code startDate} to {@code startDate + 100 years}.
|
||||
* @see #get2DigitYearStart
|
||||
* @throws NullPointerException if {@code startDate} is {@code null}.
|
||||
* @since 1.2
|
||||
|
@ -939,8 +939,8 @@ public class SimpleDateFormat extends DateFormat {
|
|||
}
|
||||
|
||||
/**
|
||||
* Formats the given <code>Date</code> into a date/time string and appends
|
||||
* the result to the given <code>StringBuffer</code>.
|
||||
* Formats the given {@code Date} into a date/time string and appends
|
||||
* the result to the given {@code StringBuffer}.
|
||||
*
|
||||
* @param date the date-time value to be formatted into a date-time string.
|
||||
* @param toAppendTo where the new date-time text is to be appended.
|
||||
|
@ -1003,13 +1003,13 @@ public class SimpleDateFormat extends DateFormat {
|
|||
}
|
||||
|
||||
/**
|
||||
* Formats an Object producing an <code>AttributedCharacterIterator</code>.
|
||||
* You can use the returned <code>AttributedCharacterIterator</code>
|
||||
* Formats an Object producing an {@code AttributedCharacterIterator}.
|
||||
* You can use the returned {@code AttributedCharacterIterator}
|
||||
* to build the resulting String, as well as to determine information
|
||||
* about the resulting String.
|
||||
* <p>
|
||||
* Each attribute key of the AttributedCharacterIterator will be of type
|
||||
* <code>DateFormat.Field</code>, with the corresponding attribute value
|
||||
* {@code DateFormat.Field}, with the corresponding attribute value
|
||||
* being the same as the attribute key.
|
||||
*
|
||||
* @throws NullPointerException if obj is null.
|
||||
|
@ -1427,17 +1427,17 @@ public class SimpleDateFormat extends DateFormat {
|
|||
|
||||
|
||||
/**
|
||||
* Parses text from a string to produce a <code>Date</code>.
|
||||
* Parses text from a string to produce a {@code Date}.
|
||||
* <p>
|
||||
* The method attempts to parse text starting at the index given by
|
||||
* <code>pos</code>.
|
||||
* If parsing succeeds, then the index of <code>pos</code> is updated
|
||||
* {@code pos}.
|
||||
* If parsing succeeds, then the index of {@code pos} is updated
|
||||
* to the index after the last character used (parsing does not necessarily
|
||||
* use all characters up to the end of the string), and the parsed
|
||||
* date is returned. The updated <code>pos</code> can be used to
|
||||
* date is returned. The updated {@code pos} can be used to
|
||||
* indicate the starting point for the next call to this method.
|
||||
* If an error occurs, then the index of <code>pos</code> is not
|
||||
* changed, the error index of <code>pos</code> is set to the index of
|
||||
* If an error occurs, then the index of {@code pos} is not
|
||||
* changed, the error index of {@code pos} is set to the index of
|
||||
* the character where the error occurred, and null is returned.
|
||||
*
|
||||
* <p>This parsing operation uses the {@link DateFormat#calendar
|
||||
|
@ -1454,12 +1454,12 @@ public class SimpleDateFormat extends DateFormat {
|
|||
* {@link #setTimeZone(java.util.TimeZone) setTimeZone} may need
|
||||
* to be restored for further operations.
|
||||
*
|
||||
* @param text A <code>String</code>, part of which should be parsed.
|
||||
* @param pos A <code>ParsePosition</code> object with index and error
|
||||
* @param text A {@code String}, part of which should be parsed.
|
||||
* @param pos A {@code ParsePosition} object with index and error
|
||||
* index information as described above.
|
||||
* @return A <code>Date</code> parsed from the string. In case of
|
||||
* @return A {@code Date} parsed from the string. In case of
|
||||
* error, returns null.
|
||||
* @throws NullPointerException if <code>text</code> or <code>pos</code> is null.
|
||||
* @throws NullPointerException if {@code text} or {@code pos} is null.
|
||||
*/
|
||||
@Override
|
||||
public Date parse(String text, ParsePosition pos)
|
||||
|
@ -2393,10 +2393,10 @@ public class SimpleDateFormat extends DateFormat {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a copy of this <code>SimpleDateFormat</code>. This also
|
||||
* Creates a copy of this {@code SimpleDateFormat}. This also
|
||||
* clones the format's date format symbols.
|
||||
*
|
||||
* @return a clone of this <code>SimpleDateFormat</code>
|
||||
* @return a clone of this {@code SimpleDateFormat}
|
||||
*/
|
||||
@Override
|
||||
public Object clone() {
|
||||
|
@ -2406,9 +2406,9 @@ public class SimpleDateFormat extends DateFormat {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the hash code value for this <code>SimpleDateFormat</code> object.
|
||||
* Returns the hash code value for this {@code SimpleDateFormat} object.
|
||||
*
|
||||
* @return the hash code value for this <code>SimpleDateFormat</code> object.
|
||||
* @return the hash code value for this {@code SimpleDateFormat} object.
|
||||
*/
|
||||
@Override
|
||||
public int hashCode()
|
||||
|
@ -2418,11 +2418,11 @@ public class SimpleDateFormat extends DateFormat {
|
|||
}
|
||||
|
||||
/**
|
||||
* Compares the given object with this <code>SimpleDateFormat</code> for
|
||||
* Compares the given object with this {@code SimpleDateFormat} for
|
||||
* equality.
|
||||
*
|
||||
* @return true if the given object is equal to this
|
||||
* <code>SimpleDateFormat</code>
|
||||
* {@code SimpleDateFormat}
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -41,10 +41,10 @@
|
|||
package java.text;
|
||||
|
||||
/**
|
||||
* <code>StringCharacterIterator</code> implements the
|
||||
* <code>CharacterIterator</code> protocol for a <code>String</code>.
|
||||
* The <code>StringCharacterIterator</code> class iterates over the
|
||||
* entire <code>String</code>.
|
||||
* {@code StringCharacterIterator} implements the
|
||||
* {@code CharacterIterator} protocol for a {@code String}.
|
||||
* The {@code StringCharacterIterator} class iterates over the
|
||||
* entire {@code String}.
|
||||
*
|
||||
* @see CharacterIterator
|
||||
* @since 1.1
|
||||
|
|
|
@ -46,13 +46,13 @@ public abstract class BreakIteratorProvider extends LocaleServiceProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new <code>BreakIterator</code> instance
|
||||
* Returns a new {@code BreakIterator} instance
|
||||
* for <a href="../BreakIterator.html#word">word breaks</a>
|
||||
* for the given locale.
|
||||
* @param locale the desired locale
|
||||
* @return A break iterator for word breaks
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws IllegalArgumentException if <code>locale</code> isn't
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
* @throws IllegalArgumentException if {@code locale} isn't
|
||||
* one of the locales returned from
|
||||
* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
|
||||
* getAvailableLocales()}.
|
||||
|
@ -61,13 +61,13 @@ public abstract class BreakIteratorProvider extends LocaleServiceProvider {
|
|||
public abstract BreakIterator getWordInstance(Locale locale);
|
||||
|
||||
/**
|
||||
* Returns a new <code>BreakIterator</code> instance
|
||||
* Returns a new {@code BreakIterator} instance
|
||||
* for <a href="../BreakIterator.html#line">line breaks</a>
|
||||
* for the given locale.
|
||||
* @param locale the desired locale
|
||||
* @return A break iterator for line breaks
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws IllegalArgumentException if <code>locale</code> isn't
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
* @throws IllegalArgumentException if {@code locale} isn't
|
||||
* one of the locales returned from
|
||||
* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
|
||||
* getAvailableLocales()}.
|
||||
|
@ -76,13 +76,13 @@ public abstract class BreakIteratorProvider extends LocaleServiceProvider {
|
|||
public abstract BreakIterator getLineInstance(Locale locale);
|
||||
|
||||
/**
|
||||
* Returns a new <code>BreakIterator</code> instance
|
||||
* Returns a new {@code BreakIterator} instance
|
||||
* for <a href="../BreakIterator.html#character">character breaks</a>
|
||||
* for the given locale.
|
||||
* @param locale the desired locale
|
||||
* @return A break iterator for character breaks
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws IllegalArgumentException if <code>locale</code> isn't
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
* @throws IllegalArgumentException if {@code locale} isn't
|
||||
* one of the locales returned from
|
||||
* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
|
||||
* getAvailableLocales()}.
|
||||
|
@ -91,13 +91,13 @@ public abstract class BreakIteratorProvider extends LocaleServiceProvider {
|
|||
public abstract BreakIterator getCharacterInstance(Locale locale);
|
||||
|
||||
/**
|
||||
* Returns a new <code>BreakIterator</code> instance
|
||||
* Returns a new {@code BreakIterator} instance
|
||||
* for <a href="../BreakIterator.html#sentence">sentence breaks</a>
|
||||
* for the given locale.
|
||||
* @param locale the desired locale
|
||||
* @return A break iterator for sentence breaks
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws IllegalArgumentException if <code>locale</code> isn't
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
* @throws IllegalArgumentException if {@code locale} isn't
|
||||
* one of the locales returned from
|
||||
* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
|
||||
* getAvailableLocales()}.
|
||||
|
|
|
@ -46,12 +46,12 @@ public abstract class CollatorProvider extends LocaleServiceProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new <code>Collator</code> instance for the specified locale.
|
||||
* Returns a new {@code Collator} instance for the specified locale.
|
||||
* @param locale the desired locale.
|
||||
* @return the <code>Collator</code> for the desired locale.
|
||||
* @return the {@code Collator} for the desired locale.
|
||||
* @throws NullPointerException if
|
||||
* <code>locale</code> is null
|
||||
* @throws IllegalArgumentException if <code>locale</code> isn't
|
||||
* {@code locale} is null
|
||||
* @throws IllegalArgumentException if {@code locale} isn't
|
||||
* one of the locales returned from
|
||||
* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
|
||||
* getAvailableLocales()}.
|
||||
|
|
|
@ -46,7 +46,7 @@ public abstract class DateFormatProvider extends LocaleServiceProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new <code>DateFormat</code> instance which formats time
|
||||
* Returns a new {@code DateFormat} instance which formats time
|
||||
* with the given formatting style for the specified locale.
|
||||
* @param style the given formatting style. Either one of
|
||||
* {@link java.text.DateFormat#SHORT DateFormat.SHORT},
|
||||
|
@ -54,19 +54,19 @@ public abstract class DateFormatProvider extends LocaleServiceProvider {
|
|||
* {@link java.text.DateFormat#LONG DateFormat.LONG}, or
|
||||
* {@link java.text.DateFormat#FULL DateFormat.FULL}.
|
||||
* @param locale the desired locale.
|
||||
* @throws IllegalArgumentException if <code>style</code> is invalid,
|
||||
* or if <code>locale</code> isn't
|
||||
* @throws IllegalArgumentException if {@code style} is invalid,
|
||||
* or if {@code locale} isn't
|
||||
* one of the locales returned from
|
||||
* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
|
||||
* getAvailableLocales()}.
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
* @return a time formatter.
|
||||
* @see java.text.DateFormat#getTimeInstance(int, java.util.Locale)
|
||||
*/
|
||||
public abstract DateFormat getTimeInstance(int style, Locale locale);
|
||||
|
||||
/**
|
||||
* Returns a new <code>DateFormat</code> instance which formats date
|
||||
* Returns a new {@code DateFormat} instance which formats date
|
||||
* with the given formatting style for the specified locale.
|
||||
* @param style the given formatting style. Either one of
|
||||
* {@link java.text.DateFormat#SHORT DateFormat.SHORT},
|
||||
|
@ -74,19 +74,19 @@ public abstract class DateFormatProvider extends LocaleServiceProvider {
|
|||
* {@link java.text.DateFormat#LONG DateFormat.LONG}, or
|
||||
* {@link java.text.DateFormat#FULL DateFormat.FULL}.
|
||||
* @param locale the desired locale.
|
||||
* @throws IllegalArgumentException if <code>style</code> is invalid,
|
||||
* or if <code>locale</code> isn't
|
||||
* @throws IllegalArgumentException if {@code style} is invalid,
|
||||
* or if {@code locale} isn't
|
||||
* one of the locales returned from
|
||||
* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
|
||||
* getAvailableLocales()}.
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
* @return a date formatter.
|
||||
* @see java.text.DateFormat#getDateInstance(int, java.util.Locale)
|
||||
*/
|
||||
public abstract DateFormat getDateInstance(int style, Locale locale);
|
||||
|
||||
/**
|
||||
* Returns a new <code>DateFormat</code> instance which formats date and time
|
||||
* Returns a new {@code DateFormat} instance which formats date and time
|
||||
* with the given formatting style for the specified locale.
|
||||
* @param dateStyle the given date formatting style. Either one of
|
||||
* {@link java.text.DateFormat#SHORT DateFormat.SHORT},
|
||||
|
@ -99,13 +99,13 @@ public abstract class DateFormatProvider extends LocaleServiceProvider {
|
|||
* {@link java.text.DateFormat#LONG DateFormat.LONG}, or
|
||||
* {@link java.text.DateFormat#FULL DateFormat.FULL}.
|
||||
* @param locale the desired locale.
|
||||
* @throws IllegalArgumentException if <code>dateStyle</code> or
|
||||
* <code>timeStyle</code> is invalid,
|
||||
* or if <code>locale</code> isn't
|
||||
* @throws IllegalArgumentException if {@code dateStyle} or
|
||||
* {@code timeStyle} is invalid,
|
||||
* or if {@code locale} isn't
|
||||
* one of the locales returned from
|
||||
* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
|
||||
* getAvailableLocales()}.
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
* @return a date/time formatter.
|
||||
* @see java.text.DateFormat#getDateTimeInstance(int, int, java.util.Locale)
|
||||
*/
|
||||
|
|
|
@ -46,16 +46,16 @@ public abstract class DateFormatSymbolsProvider extends LocaleServiceProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new <code>DateFormatSymbols</code> instance for the
|
||||
* Returns a new {@code DateFormatSymbols} instance for the
|
||||
* specified locale.
|
||||
*
|
||||
* @param locale the desired locale
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws IllegalArgumentException if <code>locale</code> isn't
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
* @throws IllegalArgumentException if {@code locale} isn't
|
||||
* one of the locales returned from
|
||||
* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
|
||||
* getAvailableLocales()}.
|
||||
* @return a <code>DateFormatSymbols</code> instance.
|
||||
* @return a {@code DateFormatSymbols} instance.
|
||||
* @see java.text.DateFormatSymbols#getInstance(java.util.Locale)
|
||||
*/
|
||||
public abstract DateFormatSymbols getInstance(Locale locale);
|
||||
|
|
|
@ -56,16 +56,16 @@ public abstract class DecimalFormatSymbolsProvider extends LocaleServiceProvider
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new <code>DecimalFormatSymbols</code> instance for the
|
||||
* Returns a new {@code DecimalFormatSymbols} instance for the
|
||||
* specified locale.
|
||||
*
|
||||
* @param locale the desired locale
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws IllegalArgumentException if <code>locale</code> isn't
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
* @throws IllegalArgumentException if {@code locale} isn't
|
||||
* one of the locales returned from
|
||||
* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
|
||||
* getAvailableLocales()}.
|
||||
* @return a <code>DecimalFormatSymbols</code> instance.
|
||||
* @return a {@code DecimalFormatSymbols} instance.
|
||||
* @see java.text.DecimalFormatSymbols#getInstance(java.util.Locale)
|
||||
*/
|
||||
public abstract DecimalFormatSymbols getInstance(Locale locale);
|
||||
|
|
|
@ -46,12 +46,12 @@ public abstract class NumberFormatProvider extends LocaleServiceProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new <code>NumberFormat</code> instance which formats
|
||||
* Returns a new {@code NumberFormat} instance which formats
|
||||
* monetary values for the specified locale.
|
||||
*
|
||||
* @param locale the desired locale.
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws IllegalArgumentException if <code>locale</code> isn't
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
* @throws IllegalArgumentException if {@code locale} isn't
|
||||
* one of the locales returned from
|
||||
* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
|
||||
* getAvailableLocales()}.
|
||||
|
@ -61,7 +61,7 @@ public abstract class NumberFormatProvider extends LocaleServiceProvider {
|
|||
public abstract NumberFormat getCurrencyInstance(Locale locale);
|
||||
|
||||
/**
|
||||
* Returns a new <code>NumberFormat</code> instance which formats
|
||||
* Returns a new {@code NumberFormat} instance which formats
|
||||
* integer values for the specified locale.
|
||||
* The returned number format is configured to
|
||||
* round floating point numbers to the nearest integer using
|
||||
|
@ -71,8 +71,8 @@ public abstract class NumberFormatProvider extends LocaleServiceProvider {
|
|||
* java.text.NumberFormat#isParseIntegerOnly isParseIntegerOnly}).
|
||||
*
|
||||
* @param locale the desired locale
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws IllegalArgumentException if <code>locale</code> isn't
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
* @throws IllegalArgumentException if {@code locale} isn't
|
||||
* one of the locales returned from
|
||||
* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
|
||||
* getAvailableLocales()}.
|
||||
|
@ -82,12 +82,12 @@ public abstract class NumberFormatProvider extends LocaleServiceProvider {
|
|||
public abstract NumberFormat getIntegerInstance(Locale locale);
|
||||
|
||||
/**
|
||||
* Returns a new general-purpose <code>NumberFormat</code> instance for
|
||||
* Returns a new general-purpose {@code NumberFormat} instance for
|
||||
* the specified locale.
|
||||
*
|
||||
* @param locale the desired locale
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws IllegalArgumentException if <code>locale</code> isn't
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
* @throws IllegalArgumentException if {@code locale} isn't
|
||||
* one of the locales returned from
|
||||
* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
|
||||
* getAvailableLocales()}.
|
||||
|
@ -97,12 +97,12 @@ public abstract class NumberFormatProvider extends LocaleServiceProvider {
|
|||
public abstract NumberFormat getNumberInstance(Locale locale);
|
||||
|
||||
/**
|
||||
* Returns a new <code>NumberFormat</code> instance which formats
|
||||
* Returns a new {@code NumberFormat} instance which formats
|
||||
* percentage values for the specified locale.
|
||||
*
|
||||
* @param locale the desired locale
|
||||
* @throws NullPointerException if <code>locale</code> is null
|
||||
* @throws IllegalArgumentException if <code>locale</code> isn't
|
||||
* @throws NullPointerException if {@code locale} is null
|
||||
* @throws IllegalArgumentException if {@code locale} isn't
|
||||
* one of the locales returned from
|
||||
* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
|
||||
* getAvailableLocales()}.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue