mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-7063 merged branch - rev 27439
X-SVN-Rev: 26474
This commit is contained in:
parent
66b106094d
commit
766b01ec0c
61 changed files with 628 additions and 277 deletions
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2008, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*
|
||||
|
@ -219,13 +219,15 @@ public final class CollationElementIterator
|
|||
* <p>If the RuleBasedCollator used by this iterator has had its
|
||||
* attributes changed, calling reset() will reinitialize the
|
||||
* iterator to use the new attributes.</p>
|
||||
* @return
|
||||
*
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void reset()
|
||||
public CollationElementIterator reset()
|
||||
{
|
||||
m_source_.setToStart();
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -452,9 +454,10 @@ public final class CollationElementIterator
|
|||
* @param offset the character offset into the original source string to
|
||||
* set. Note that this is not an offset into the corresponding
|
||||
* sequence of collation elements.
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setOffset(int offset)
|
||||
public CollationElementIterator setOffset(int offset)
|
||||
{
|
||||
m_source_.setIndex(offset);
|
||||
int ch_int = m_source_.current();
|
||||
|
@ -501,6 +504,7 @@ public final class CollationElementIterator
|
|||
// the string again if we are at the end
|
||||
m_isForwards_ = true;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -508,13 +512,15 @@ public final class CollationElementIterator
|
|||
* to the beginning of the text.</p>
|
||||
*
|
||||
* @param source the new source string for iteration.
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setText(String source)
|
||||
public CollationElementIterator setText(String source)
|
||||
{
|
||||
m_srcUtilIter_.setText(source);
|
||||
m_source_ = m_srcUtilIter_;
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -524,13 +530,15 @@ public final class CollationElementIterator
|
|||
* <p>The source iterator's integrity will be preserved since a new copy
|
||||
* will be created for use.</p>
|
||||
* @param source the new source string iterator for iteration.
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setText(UCharacterIterator source)
|
||||
public CollationElementIterator setText(UCharacterIterator source)
|
||||
{
|
||||
m_srcUtilIter_.setText(source.getText());
|
||||
m_source_ = m_srcUtilIter_;
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -538,13 +546,15 @@ public final class CollationElementIterator
|
|||
* offset to the beginning of the text.
|
||||
* </p>
|
||||
* @param source the new source string iterator for iteration.
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setText(CharacterIterator source)
|
||||
public CollationElementIterator setText(CharacterIterator source)
|
||||
{
|
||||
m_source_ = new CharacterIteratorWrapper(source);
|
||||
m_source_.setToStart();
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
// public miscellaneous methods -----------------------------------------
|
||||
|
|
|
@ -237,6 +237,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
|
|||
*
|
||||
* <p>See the Collator class description for an example of use.</p>
|
||||
* @param newStrength the new strength value.
|
||||
* @return
|
||||
* @see #getStrength
|
||||
* @see #PRIMARY
|
||||
* @see #SECONDARY
|
||||
|
@ -247,7 +248,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
|
|||
* of PRIMARY, SECONDARY, TERTIARY, QUATERNARY or IDENTICAL.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setStrength(int newStrength)
|
||||
public Collator setStrength(int newStrength)
|
||||
{
|
||||
if ((newStrength != PRIMARY) &&
|
||||
(newStrength != SECONDARY) &&
|
||||
|
@ -257,6 +258,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
|
|||
throw new IllegalArgumentException("Incorrect comparison level.");
|
||||
}
|
||||
m_strength_ = newStrength;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -291,6 +293,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
|
|||
* mode.</p>
|
||||
*
|
||||
* @param decomposition the new decomposition mode
|
||||
* @return
|
||||
* @see #getDecomposition
|
||||
* @see #NO_DECOMPOSITION
|
||||
* @see #CANONICAL_DECOMPOSITION
|
||||
|
@ -298,13 +301,14 @@ public abstract class Collator implements Comparator<Object>, Cloneable
|
|||
* decomposition mode.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setDecomposition(int decomposition)
|
||||
public Collator setDecomposition(int decomposition)
|
||||
{
|
||||
if ((decomposition != NO_DECOMPOSITION) &&
|
||||
(decomposition != CANONICAL_DECOMPOSITION)) {
|
||||
throw new IllegalArgumentException("Wrong decomposition mode.");
|
||||
}
|
||||
m_decomposition_ = decomposition;
|
||||
return this;
|
||||
}
|
||||
|
||||
// public getters --------------------------------------------------------
|
||||
|
@ -966,7 +970,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
|
|||
* @see #setVariableTop
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
public abstract void setVariableTop(int varTop);
|
||||
public abstract Collator setVariableTop(int varTop);
|
||||
|
||||
/**
|
||||
* Get the version of this collator object.
|
||||
|
|
|
@ -284,28 +284,32 @@ public final class RuleBasedCollator extends Collator
|
|||
* distinguishing between Katakana and Hiragana characters.
|
||||
* @param flag true if Hiragana Quaternary mode is to be on, false
|
||||
* otherwise
|
||||
* @return
|
||||
* @see #setHiraganaQuaternaryDefault
|
||||
* @see #isHiraganaQuaternary
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setHiraganaQuaternary(boolean flag)
|
||||
public RuleBasedCollator setHiraganaQuaternary(boolean flag)
|
||||
{
|
||||
m_isHiragana4_ = flag;
|
||||
updateInternalState();
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Hiragana Quaternary mode to the initial mode set during
|
||||
* construction of the RuleBasedCollator.
|
||||
* See setHiraganaQuaternary(boolean) for more details.
|
||||
* @return
|
||||
* @see #setHiraganaQuaternary(boolean)
|
||||
* @see #isHiraganaQuaternary
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setHiraganaQuaternaryDefault()
|
||||
public RuleBasedCollator setHiraganaQuaternaryDefault()
|
||||
{
|
||||
m_isHiragana4_ = m_defaultIsHiragana4_;
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -317,13 +321,14 @@ public final class RuleBasedCollator extends Collator
|
|||
* @param upperfirst true to sort uppercase characters before
|
||||
* lowercase characters, false to sort lowercase
|
||||
* characters before uppercase characters
|
||||
* @return
|
||||
* @see #isLowerCaseFirst
|
||||
* @see #isUpperCaseFirst
|
||||
* @see #setLowerCaseFirst
|
||||
* @see #setCaseFirstDefault
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setUpperCaseFirst(boolean upperfirst)
|
||||
public RuleBasedCollator setUpperCaseFirst(boolean upperfirst)
|
||||
{
|
||||
if (upperfirst) {
|
||||
if(m_caseFirst_ != AttributeValue.UPPER_FIRST_) {
|
||||
|
@ -338,6 +343,7 @@ public final class RuleBasedCollator extends Collator
|
|||
m_caseFirst_ = AttributeValue.OFF_;
|
||||
}
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -351,13 +357,14 @@ public final class RuleBasedCollator extends Collator
|
|||
* @param lowerfirst true for sorting lower cased characters before
|
||||
* upper cased characters, false to ignore case
|
||||
* preferences.
|
||||
* @return
|
||||
* @see #isLowerCaseFirst
|
||||
* @see #isUpperCaseFirst
|
||||
* @see #setUpperCaseFirst
|
||||
* @see #setCaseFirstDefault
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setLowerCaseFirst(boolean lowerfirst)
|
||||
public RuleBasedCollator setLowerCaseFirst(boolean lowerfirst)
|
||||
{
|
||||
if (lowerfirst) {
|
||||
if(m_caseFirst_ != AttributeValue.LOWER_FIRST_) {
|
||||
|
@ -372,6 +379,7 @@ public final class RuleBasedCollator extends Collator
|
|||
m_caseFirst_ = AttributeValue.OFF_;
|
||||
}
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -379,92 +387,104 @@ public final class RuleBasedCollator extends Collator
|
|||
* construction of the RuleBasedCollator.
|
||||
* See setUpperCaseFirst(boolean) and setLowerCaseFirst(boolean) for more
|
||||
* details.
|
||||
* @return
|
||||
* @see #isLowerCaseFirst
|
||||
* @see #isUpperCaseFirst
|
||||
* @see #setLowerCaseFirst(boolean)
|
||||
* @see #setUpperCaseFirst(boolean)
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public final void setCaseFirstDefault()
|
||||
public final RuleBasedCollator setCaseFirstDefault()
|
||||
{
|
||||
if(m_caseFirst_ != m_defaultCaseFirst_) {
|
||||
latinOneRegenTable_ = true;
|
||||
}
|
||||
m_caseFirst_ = m_defaultCaseFirst_;
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the alternate handling mode to the initial mode set during
|
||||
* construction of the RuleBasedCollator.
|
||||
* See setAlternateHandling(boolean) for more details.
|
||||
* @return
|
||||
* @see #setAlternateHandlingShifted(boolean)
|
||||
* @see #isAlternateHandlingShifted()
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setAlternateHandlingDefault()
|
||||
public RuleBasedCollator setAlternateHandlingDefault()
|
||||
{
|
||||
m_isAlternateHandlingShifted_ = m_defaultIsAlternateHandlingShifted_;
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the case level mode to the initial mode set during
|
||||
* construction of the RuleBasedCollator.
|
||||
* See setCaseLevel(boolean) for more details.
|
||||
* @return
|
||||
* @see #setCaseLevel(boolean)
|
||||
* @see #isCaseLevel
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setCaseLevelDefault()
|
||||
public RuleBasedCollator setCaseLevelDefault()
|
||||
{
|
||||
m_isCaseLevel_ = m_defaultIsCaseLevel_;
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the decomposition mode to the initial mode set during construction
|
||||
* of the RuleBasedCollator.
|
||||
* See setDecomposition(int) for more details.
|
||||
* @return
|
||||
* @see #getDecomposition
|
||||
* @see #setDecomposition(int)
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setDecompositionDefault()
|
||||
public RuleBasedCollator setDecompositionDefault()
|
||||
{
|
||||
setDecomposition(m_defaultDecomposition_);
|
||||
updateInternalState();
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the French collation mode to the initial mode set during
|
||||
* construction of the RuleBasedCollator.
|
||||
* See setFrenchCollation(boolean) for more details.
|
||||
* @return
|
||||
* @see #isFrenchCollation
|
||||
* @see #setFrenchCollation(boolean)
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setFrenchCollationDefault()
|
||||
public RuleBasedCollator setFrenchCollationDefault()
|
||||
{
|
||||
if(m_isFrenchCollation_ != m_defaultIsFrenchCollation_) {
|
||||
latinOneRegenTable_ = true;
|
||||
}
|
||||
m_isFrenchCollation_ = m_defaultIsFrenchCollation_;
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the collation strength to the initial mode set during the
|
||||
* construction of the RuleBasedCollator.
|
||||
* See setStrength(int) for more details.
|
||||
* @return
|
||||
* @see #setStrength(int)
|
||||
* @see #getStrength
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setStrengthDefault()
|
||||
public RuleBasedCollator setStrengthDefault()
|
||||
{
|
||||
setStrength(m_defaultStrength_);
|
||||
updateInternalState();
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -472,14 +492,16 @@ public final class RuleBasedCollator extends Collator
|
|||
* When numeric collation is turned on, this Collator generates a collation
|
||||
* key for the numeric value of substrings of digits. This is a way to get
|
||||
* '100' to sort AFTER '2'
|
||||
* @return
|
||||
* @see #getNumericCollation
|
||||
* @see #setNumericCollation
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setNumericCollationDefault()
|
||||
public RuleBasedCollator setNumericCollationDefault()
|
||||
{
|
||||
setNumericCollation(m_defaultIsNumericCollation_);
|
||||
updateInternalState();
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -492,17 +514,19 @@ public final class RuleBasedCollator extends Collator
|
|||
* <a href="http://www.icu-project.org/userguide/Collate_ServiceArchitecture.html">
|
||||
* French collation</a> for more information.
|
||||
* @param flag true to set the French collation on, false to set it off
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
* @see #isFrenchCollation
|
||||
* @see #setFrenchCollationDefault
|
||||
*/
|
||||
public void setFrenchCollation(boolean flag)
|
||||
public RuleBasedCollator setFrenchCollation(boolean flag)
|
||||
{
|
||||
if(m_isFrenchCollation_ != flag) {
|
||||
latinOneRegenTable_ = true;
|
||||
}
|
||||
m_isFrenchCollation_ = flag;
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -522,14 +546,16 @@ public final class RuleBasedCollator extends Collator
|
|||
* moved to the QUATERNARY order.
|
||||
* @param shifted true if SHIFTED behaviour for alternate handling is
|
||||
* desired, false for the NON_IGNORABLE behaviour.
|
||||
* @return
|
||||
* @see #isAlternateHandlingShifted
|
||||
* @see #setAlternateHandlingDefault
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setAlternateHandlingShifted(boolean shifted)
|
||||
public RuleBasedCollator setAlternateHandlingShifted(boolean shifted)
|
||||
{
|
||||
m_isAlternateHandlingShifted_ = shifted;
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -550,14 +576,16 @@ public final class RuleBasedCollator extends Collator
|
|||
* case level</a> for more information.
|
||||
* </p>
|
||||
* @param flag true if case level sorting is required, false otherwise
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
* @see #setCaseLevelDefault
|
||||
* @see #isCaseLevel
|
||||
*/
|
||||
public void setCaseLevel(boolean flag)
|
||||
public RuleBasedCollator setCaseLevel(boolean flag)
|
||||
{
|
||||
m_isCaseLevel_ = flag;
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -568,6 +596,7 @@ public final class RuleBasedCollator extends Collator
|
|||
* </p>
|
||||
* <p>See the Collator class description for an example of use.</p>
|
||||
* @param newStrength the new strength value.
|
||||
* @return
|
||||
* @see #getStrength
|
||||
* @see #setStrengthDefault
|
||||
* @see #PRIMARY
|
||||
|
@ -579,10 +608,11 @@ public final class RuleBasedCollator extends Collator
|
|||
* of PRIMARY, SECONDARY, TERTIARY, QUATERNARY or IDENTICAL.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setStrength(int newStrength)
|
||||
public RuleBasedCollator setStrength(int newStrength)
|
||||
{
|
||||
super.setStrength(newStrength);
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -656,13 +686,15 @@ public final class RuleBasedCollator extends Collator
|
|||
* Lower 16 bits are ignored.
|
||||
* @param varTop Collation element value, as returned by setVariableTop or
|
||||
* getVariableTop
|
||||
* @return
|
||||
* @see #getVariableTop
|
||||
* @see #setVariableTop(String)
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
public void setVariableTop(int varTop)
|
||||
public RuleBasedCollator setVariableTop(int varTop)
|
||||
{
|
||||
m_variableTopValue_ = (varTop & CE_PRIMARY_MASK_) >> 16;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -670,15 +702,17 @@ public final class RuleBasedCollator extends Collator
|
|||
* key for the numeric value of substrings of digits. This is a way to get
|
||||
* '100' to sort AFTER '2'
|
||||
* @param flag true to turn numeric collation on and false to turn it off
|
||||
* @return
|
||||
* @see #getNumericCollation
|
||||
* @see #setNumericCollationDefault
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setNumericCollation(boolean flag)
|
||||
public RuleBasedCollator setNumericCollation(boolean flag)
|
||||
{
|
||||
// sort substrings of digits as numbers
|
||||
m_isNumericCollation_ = flag;
|
||||
updateInternalState();
|
||||
return this;
|
||||
}
|
||||
|
||||
// public getters --------------------------------------------------------
|
||||
|
@ -857,11 +891,11 @@ public final class RuleBasedCollator extends Collator
|
|||
* @param contractions if not null, set to contain contractions
|
||||
* @param expansions if not null, set to contain expansions
|
||||
* @param addPrefixes add the prefix contextual elements to contractions
|
||||
* @return
|
||||
* @throws Exception
|
||||
* @stable ICU 3.4
|
||||
*/
|
||||
public void
|
||||
getContractionsAndExpansions(UnicodeSet contractions, UnicodeSet expansions,
|
||||
public RuleBasedCollator getContractionsAndExpansions(UnicodeSet contractions, UnicodeSet expansions,
|
||||
boolean addPrefixes) throws Exception {
|
||||
if(contractions != null) {
|
||||
contractions.clear();
|
||||
|
@ -884,6 +918,7 @@ public final class RuleBasedCollator extends Collator
|
|||
} catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2007, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -350,11 +350,12 @@ public final class StringSearch extends SearchIterator
|
|||
* to be recalculated, but the iterator's position is unchanged.
|
||||
* </p>
|
||||
* @param collator to use for this StringSearch
|
||||
* @return
|
||||
* @exception IllegalArgumentException thrown when collator is null
|
||||
* @see #getCollator
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setCollator(RuleBasedCollator collator)
|
||||
public StringSearch setCollator(RuleBasedCollator collator)
|
||||
{
|
||||
if (collator == null) {
|
||||
throw new IllegalArgumentException("Collator can not be null");
|
||||
|
@ -367,6 +368,7 @@ public final class StringSearch extends SearchIterator
|
|||
m_utilColEIter_.setCollator(m_collator_);
|
||||
m_charBreakIter_ = BreakIterator.getCharacterInstance(/*collator.getLocale(ULocale.VALID_LOCALE)*/);
|
||||
m_charBreakIter_.setText(targetText);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -378,12 +380,13 @@ public final class StringSearch extends SearchIterator
|
|||
* to be recalculated, but the iterator's position is unchanged.
|
||||
* </p>
|
||||
* @param pattern for searching
|
||||
* @return
|
||||
* @see #getPattern
|
||||
* @exception IllegalArgumentException thrown if pattern is null or of
|
||||
* length 0
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setPattern(String pattern)
|
||||
public StringSearch setPattern(String pattern)
|
||||
{
|
||||
if (pattern == null || pattern.length() <= 0) {
|
||||
throw new IllegalArgumentException(
|
||||
|
@ -391,6 +394,7 @@ public final class StringSearch extends SearchIterator
|
|||
}
|
||||
m_pattern_.targetText = pattern;
|
||||
initialize();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -398,18 +402,20 @@ public final class StringSearch extends SearchIterator
|
|||
* the start of the text string. This method is useful if you want to
|
||||
* re-use an iterator to search within a different body of text.
|
||||
* @param text new text iterator to look for match,
|
||||
* @return
|
||||
* @exception IllegalArgumentException thrown when text is null or has
|
||||
* 0 length
|
||||
* @see #getTarget
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setTarget(CharacterIterator text)
|
||||
public StringSearch setTarget(CharacterIterator text)
|
||||
{
|
||||
super.setTarget(text);
|
||||
m_textBeginOffset_ = targetText.getBeginIndex();
|
||||
m_textLimitOffset_ = targetText.getEndIndex();
|
||||
m_colEIter_.setText(targetText);
|
||||
m_charBreakIter_.setText(targetText);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -427,16 +433,18 @@ public final class StringSearch extends SearchIterator
|
|||
* the class documentation.
|
||||
* </p>
|
||||
* @param position index to start next search from.
|
||||
* @return
|
||||
* @exception IndexOutOfBoundsException thrown if argument position is out
|
||||
* of the target text range.
|
||||
* @see #getIndex
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setIndex(int position)
|
||||
public StringSearch setIndex(int position)
|
||||
{
|
||||
super.setIndex(position);
|
||||
m_matchedIndex_ = DONE;
|
||||
m_colEIter_.setExactOffset(position);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -445,10 +453,11 @@ public final class StringSearch extends SearchIterator
|
|||
* The default setting for this property is false.
|
||||
* </p>
|
||||
* @param allowCanonical flag indicator if canonical matches are allowed
|
||||
* @return
|
||||
* @see #isCanonical
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setCanonical(boolean allowCanonical)
|
||||
public StringSearch setCanonical(boolean allowCanonical)
|
||||
{
|
||||
m_isCanonicalMatch_ = allowCanonical;
|
||||
if (m_isCanonicalMatch_ == true) {
|
||||
|
@ -467,6 +476,7 @@ public final class StringSearch extends SearchIterator
|
|||
m_canonicalSuffixAccents_.length());
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
// public miscellaneous methods -----------------------------------------
|
||||
|
@ -485,9 +495,10 @@ public final class StringSearch extends SearchIterator
|
|||
* <p>
|
||||
* Canonical match option will be reset to false, ie an exact match.
|
||||
* </p>
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void reset()
|
||||
public StringSearch reset()
|
||||
{
|
||||
// reset is setting the attributes that are already in string search,
|
||||
// hence all attributes in the collator should be retrieved without any
|
||||
|
@ -500,6 +511,7 @@ public final class StringSearch extends SearchIterator
|
|||
m_colEIter_.setCollator(m_collator_);
|
||||
m_colEIter_.reset();
|
||||
m_utilColEIter_.setCollator(m_collator_);
|
||||
return this;
|
||||
}
|
||||
|
||||
// protected methods -----------------------------------------------------
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -77,11 +77,13 @@ public class CharacterIteratorWrapper extends UCharacterIterator {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see UCharacterIterator#setIndex(int)
|
||||
*/
|
||||
public void setIndex(int index) {
|
||||
public CharacterIteratorWrapper setIndex(int index) {
|
||||
try{
|
||||
iterator.setIndex(index);
|
||||
return this;
|
||||
}catch(IllegalArgumentException e){
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
|
@ -90,8 +92,9 @@ public class CharacterIteratorWrapper extends UCharacterIterator {
|
|||
/**
|
||||
* @see UCharacterIterator#setToLimit()
|
||||
*/
|
||||
public void setToLimit() {
|
||||
public CharacterIteratorWrapper setToLimit() {
|
||||
iterator.setIndex(iterator.getEndIndex());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,16 +62,18 @@ public final class DateNumberFormat extends NumberFormat {
|
|||
minusSign = elems[1];
|
||||
}
|
||||
|
||||
public void setMaximumIntegerDigits(int newValue) {
|
||||
public DateNumberFormat setMaximumIntegerDigits(int newValue) {
|
||||
maxIntDigits = newValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getMaximumIntegerDigits() {
|
||||
return maxIntDigits;
|
||||
}
|
||||
|
||||
public void setMinimumIntegerDigits(int newValue) {
|
||||
public DateNumberFormat setMinimumIntegerDigits(int newValue) {
|
||||
minIntDigits = newValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getMinimumIntegerDigits() {
|
||||
|
|
|
@ -95,7 +95,7 @@ public class JavaTimeZone extends TimeZone {
|
|||
/* (non-Javadoc)
|
||||
* @see com.ibm.icu.util.TimeZone#getOffset(long, boolean, int[])
|
||||
*/
|
||||
public void getOffset(long date, boolean local, int[] offsets) {
|
||||
public JavaTimeZone getOffset(long date, boolean local, int[] offsets) {
|
||||
synchronized (javacal) {
|
||||
if (local) {
|
||||
int fields[] = new int[6];
|
||||
|
@ -135,6 +135,7 @@ public class JavaTimeZone extends TimeZone {
|
|||
offsets[0] = javacal.get(java.util.Calendar.ZONE_OFFSET);
|
||||
offsets[1] = javacal.get(java.util.Calendar.DST_OFFSET);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -154,8 +155,9 @@ public class JavaTimeZone extends TimeZone {
|
|||
/* (non-Javadoc)
|
||||
* @see com.ibm.icu.util.TimeZone#setRawOffset(int)
|
||||
*/
|
||||
public void setRawOffset(int offsetMillis) {
|
||||
public JavaTimeZone setRawOffset(int offsetMillis) {
|
||||
javatz.setRawOffset(offsetMillis);
|
||||
return this;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -169,9 +169,9 @@ public class OlsonTimeZone extends BasicTimeZone {
|
|||
/* (non-Javadoc)
|
||||
* @see com.ibm.icu.util.TimeZone#setRawOffset(int)
|
||||
*/
|
||||
public void setRawOffset(int offsetMillis) {
|
||||
public OlsonTimeZone setRawOffset(int offsetMillis) {
|
||||
if (getRawOffset() == offsetMillis) {
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
long current = System.currentTimeMillis();
|
||||
|
||||
|
@ -246,6 +246,7 @@ public class OlsonTimeZone extends BasicTimeZone {
|
|||
}
|
||||
|
||||
transitionRulesInitialized = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
|
@ -262,8 +263,9 @@ public class OlsonTimeZone extends BasicTimeZone {
|
|||
|
||||
/**
|
||||
* TimeZone API.
|
||||
* @return
|
||||
*/
|
||||
public void getOffset(long date, boolean local, int[] offsets) {
|
||||
public OlsonTimeZone getOffset(long date, boolean local, int[] offsets) {
|
||||
// The check against finalMillis will suffice most of the time, except
|
||||
// for the case in which finalMillis == DBL_MAX, date == DBL_MAX,
|
||||
// and finalZone == 0. For this case we add "&& finalZone != 0".
|
||||
|
@ -273,20 +275,23 @@ public class OlsonTimeZone extends BasicTimeZone {
|
|||
getHistoricalOffset(date, local,
|
||||
LOCAL_FORMER, LOCAL_LATTER, offsets);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @return
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public void getOffsetFromLocal(long date,
|
||||
public OlsonTimeZone getOffsetFromLocal(long date,
|
||||
int nonExistingTimeOpt, int duplicatedTimeOpt, int[] offsets) {
|
||||
if (date >= finalMillis && finalZone != null) {
|
||||
finalZone.getOffsetFromLocal(date, nonExistingTimeOpt, duplicatedTimeOpt, offsets);
|
||||
} else {
|
||||
getHistoricalOffset(date, true, nonExistingTimeOpt, duplicatedTimeOpt, offsets);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -528,12 +533,13 @@ public class OlsonTimeZone extends BasicTimeZone {
|
|||
super.setID(id);
|
||||
}
|
||||
|
||||
public void setID(String id){
|
||||
public OlsonTimeZone setID(String id){
|
||||
if(finalZone!= null){
|
||||
finalZone.setID(id);
|
||||
}
|
||||
super.setID(id);
|
||||
transitionRulesInitialized = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final int UNSIGNED_BYTE_MASK =0xFF;
|
||||
|
|
|
@ -123,7 +123,7 @@ public class RelativeDateFormat extends DateFormat {
|
|||
/* (non-Javadoc)
|
||||
* @see com.ibm.icu.text.DateFormat#parse(java.lang.String, com.ibm.icu.util.Calendar, java.text.ParsePosition)
|
||||
*/
|
||||
public void parse(String text, Calendar cal, ParsePosition pos) {
|
||||
public RelativeDateFormat parse(String text, Calendar cal, ParsePosition pos) {
|
||||
throw new UnsupportedOperationException("Relative Date parse is not implemented yet");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2005, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.impl;
|
||||
|
||||
import com.ibm.icu.text.*;
|
||||
import com.ibm.icu.text.Replaceable;
|
||||
import com.ibm.icu.text.ReplaceableString;
|
||||
import com.ibm.icu.text.UTF16;
|
||||
|
||||
/**
|
||||
* DLF docs must define behavior when Replaceable is mutated underneath
|
||||
|
@ -168,16 +165,18 @@ public class ReplaceableUCharacterIterator extends UCharacterIterator {
|
|||
* single UTF16 character at currentIndex.
|
||||
* This assumes the text is stored as 16-bit code units.</p>
|
||||
* @param currentIndex the currentIndex within the text.
|
||||
* @return
|
||||
* @exception IllegalArgumentException is thrown if an invalid currentIndex is
|
||||
* supplied. i.e. currentIndex is out of bounds.
|
||||
* @returns the character at the specified currentIndex or DONE if the specified
|
||||
* currentIndex is equal to the end of the text.
|
||||
*/
|
||||
public void setIndex(int currentIndex) throws IndexOutOfBoundsException{
|
||||
public ReplaceableUCharacterIterator setIndex(int currentIndex) throws IndexOutOfBoundsException{
|
||||
if (currentIndex < 0 || currentIndex > replaceable.length()) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
this.currentIndex = currentIndex;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getText(char[] fillIn, int offset){
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2006, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -130,15 +130,17 @@ public final class StringUCharacterIterator extends UCharacterIterator
|
|||
* returns that single UTF16 character at currentIndex.
|
||||
* This assumes the text is stored as 16-bit code units.</p>
|
||||
* @param currentIndex the currentIndex within the text.
|
||||
* @return
|
||||
* @exception IndexOutOfBoundsException is thrown if an invalid currentIndex
|
||||
* is supplied. i.e. currentIndex is out of bounds.
|
||||
*/
|
||||
public void setIndex(int currentIndex) throws IndexOutOfBoundsException
|
||||
public StringUCharacterIterator setIndex(int currentIndex) throws IndexOutOfBoundsException
|
||||
{
|
||||
if (currentIndex < 0 || currentIndex > m_text_.length()) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
m_currentIndex_ = currentIndex;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
* Copyright (C) 1996-2008, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
@ -129,8 +129,9 @@ public class TrieIterator implements RangeValueIterator
|
|||
|
||||
/**
|
||||
* Resets the iterator to the beginning of the iteration
|
||||
* @return
|
||||
*/
|
||||
public final void reset()
|
||||
public final TrieIterator reset()
|
||||
{
|
||||
m_currentCodepoint_ = 0;
|
||||
m_nextCodepoint_ = 0;
|
||||
|
@ -144,6 +145,7 @@ public class TrieIterator implements RangeValueIterator
|
|||
}
|
||||
m_nextBlockIndex_ = 0;
|
||||
m_nextTrailIndexOffset_ = TRAIL_SURROGATE_INDEX_BLOCK_LENGTH_;
|
||||
return this;
|
||||
}
|
||||
|
||||
// protected methods ----------------------------------------------
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -54,13 +54,14 @@ public final class UCharArrayIterator extends UCharacterIterator {
|
|||
return pos > start ? text[--pos] : DONE;
|
||||
}
|
||||
|
||||
public void setIndex(int index) {
|
||||
public UCharArrayIterator setIndex(int index) {
|
||||
if (index < 0 || index > limit - start) {
|
||||
throw new IndexOutOfBoundsException("index: " + index +
|
||||
" out of range [0, "
|
||||
+ (limit - start) + ")");
|
||||
}
|
||||
pos = start + index;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getText(char[] fillIn, int offset) {
|
||||
|
|
|
@ -409,7 +409,7 @@ public abstract class BreakIterator implements Cloneable
|
|||
* position is ignored, but its other state is significant).
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public abstract void setText(CharacterIterator newText);
|
||||
public abstract BreakIterator setText(CharacterIterator newText);
|
||||
|
||||
/** @stable ICU 2.4 */
|
||||
public static final int KIND_CHARACTER = 0;
|
||||
|
|
|
@ -543,7 +543,7 @@ public abstract class DateFormat extends UFormat {
|
|||
* start position if the parse failed.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public abstract void parse(String text, Calendar cal, ParsePosition pos);
|
||||
public abstract DateFormat parse(String text, Calendar cal, ParsePosition pos);
|
||||
|
||||
/**
|
||||
* Parse a date/time string according to the given parse position. For
|
||||
|
@ -1104,11 +1104,13 @@ public abstract class DateFormat extends UFormat {
|
|||
* Set the calendar to be used by this date format. Initially, the default
|
||||
* calendar for the specified or default locale is used.
|
||||
* @param newCalendar the new Calendar to be used by the date format
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setCalendar(Calendar newCalendar)
|
||||
public DateFormat setCalendar(Calendar newCalendar)
|
||||
{
|
||||
this.calendar = newCalendar;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1124,15 +1126,17 @@ public abstract class DateFormat extends UFormat {
|
|||
/**
|
||||
* Allows you to set the number formatter.
|
||||
* @param newNumberFormat the given new NumberFormat.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setNumberFormat(NumberFormat newNumberFormat)
|
||||
public DateFormat setNumberFormat(NumberFormat newNumberFormat)
|
||||
{
|
||||
this.numberFormat = newNumberFormat;
|
||||
/*In order to parse String like "11.10.2001" to DateTime correctly
|
||||
in Locale("fr","CH") [Richard/GCL]
|
||||
*/
|
||||
this.numberFormat.setParseIntegerOnly(true);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1149,11 +1153,13 @@ public abstract class DateFormat extends UFormat {
|
|||
/**
|
||||
* Sets the time zone for the calendar of this DateFormat object.
|
||||
* @param zone the given new time zone.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setTimeZone(TimeZone zone)
|
||||
public DateFormat setTimeZone(TimeZone zone)
|
||||
{
|
||||
calendar.setTimeZone(zone);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1172,12 +1178,14 @@ public abstract class DateFormat extends UFormat {
|
|||
* do not precisely match this object's format. With strict parsing,
|
||||
* inputs must match this object's format.
|
||||
* @param lenient when true, parsing is lenient
|
||||
* @return
|
||||
* @see com.ibm.icu.util.Calendar#setLenient
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setLenient(boolean lenient)
|
||||
public DateFormat setLenient(boolean lenient)
|
||||
{
|
||||
calendar.setLenient(lenient);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -793,9 +793,10 @@ public class DateIntervalFormat extends UFormat {
|
|||
/**
|
||||
* Set the date time interval patterns.
|
||||
* @param newItvPattern the given interval patterns to copy.
|
||||
* @return
|
||||
* @stable ICU 4.0
|
||||
*/
|
||||
public void setDateIntervalInfo(DateIntervalInfo newItvPattern)
|
||||
public DateIntervalFormat setDateIntervalInfo(DateIntervalInfo newItvPattern)
|
||||
{
|
||||
// clone it. If it is frozen, the clone returns itself.
|
||||
// Otherwise, clone returns a copy
|
||||
|
@ -805,6 +806,7 @@ public class DateIntervalFormat extends UFormat {
|
|||
if ( fDateFormat != null ) {
|
||||
initializePattern();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -520,13 +520,14 @@ public class DateIntervalInfo implements Cloneable, Freezable, Serializable {
|
|||
* For example, if lrgDiffCalUnit is
|
||||
* "year", the interval pattern for en_US when year
|
||||
* is different could be "'from' yyyy 'to' yyyy".
|
||||
* @return
|
||||
* @throws IllegalArgumentException if setting interval pattern on
|
||||
* a calendar field that is smaller
|
||||
* than the MINIMUM_SUPPORTED_CALENDAR_FIELD
|
||||
* @throws UnsupportedOperationException if the object is frozen
|
||||
* @stable ICU 4.0
|
||||
*/
|
||||
public void setIntervalPattern(String skeleton,
|
||||
public DateIntervalInfo setIntervalPattern(String skeleton,
|
||||
int lrgDiffCalUnit,
|
||||
String intervalPattern)
|
||||
{
|
||||
|
@ -553,6 +554,7 @@ public class DateIntervalInfo implements Cloneable, Freezable, Serializable {
|
|||
CALENDAR_FIELD_TO_PATTERN_LETTER[Calendar.DATE],
|
||||
ptnInfo);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
@ -686,13 +688,14 @@ public class DateIntervalInfo implements Cloneable, Freezable, Serializable {
|
|||
* This method provides a way for user to replace the fallback pattern.
|
||||
*
|
||||
* @param fallbackPattern fall-back interval pattern.
|
||||
* @return
|
||||
* @throws UnsupportedOperationException if the object is frozen
|
||||
* @throws IllegalArgumentException if there is no pattern {0} or
|
||||
* pattern {1} in fallbakckPattern
|
||||
*
|
||||
* @stable ICU 4.0
|
||||
*/
|
||||
public void setFallbackIntervalPattern(String fallbackPattern)
|
||||
public DateIntervalInfo setFallbackIntervalPattern(String fallbackPattern)
|
||||
{
|
||||
if ( frozen ) {
|
||||
throw new UnsupportedOperationException("no modification is allowed after DII is frozen");
|
||||
|
@ -706,6 +709,7 @@ public class DateIntervalInfo implements Cloneable, Freezable, Serializable {
|
|||
fFirstDateInPtnIsLaterDate = true;
|
||||
}
|
||||
fFallbackIntervalPattern = fallbackPattern;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -554,11 +554,13 @@ public class DateTimePatternGenerator implements Freezable, Cloneable {
|
|||
* @param dateTimeFormat
|
||||
* message format pattern, where {1} will be replaced by the date
|
||||
* pattern and {0} will be replaced by the time pattern.
|
||||
* @return
|
||||
* @stable ICU 3.6
|
||||
*/
|
||||
public void setDateTimeFormat(String dateTimeFormat) {
|
||||
public DateTimePatternGenerator setDateTimeFormat(String dateTimeFormat) {
|
||||
checkFrozen();
|
||||
this.dateTimeFormat = dateTimeFormat;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -580,11 +582,13 @@ public class DateTimePatternGenerator implements Freezable, Cloneable {
|
|||
* "H:mm:ss,SSSS"
|
||||
*
|
||||
* @param decimal
|
||||
* @return
|
||||
* @stable ICU 3.6
|
||||
*/
|
||||
public void setDecimal(String decimal) {
|
||||
public DateTimePatternGenerator setDecimal(String decimal) {
|
||||
checkFrozen();
|
||||
this.decimal = decimal;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -754,11 +758,13 @@ public class DateTimePatternGenerator implements Freezable, Cloneable {
|
|||
* such as ERA
|
||||
* @param value
|
||||
* pattern, such as "{0}, {1}"
|
||||
* @return
|
||||
* @stable ICU 3.6
|
||||
*/
|
||||
public void setAppendItemFormat(int field, String value) {
|
||||
public DateTimePatternGenerator setAppendItemFormat(int field, String value) {
|
||||
checkFrozen();
|
||||
appendItemFormats[field] = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -782,11 +788,13 @@ public class DateTimePatternGenerator implements Freezable, Cloneable {
|
|||
*
|
||||
* @param field
|
||||
* @param value
|
||||
* @return
|
||||
* @stable ICU 3.6
|
||||
*/
|
||||
public void setAppendItemName(int field, String value) {
|
||||
public DateTimePatternGenerator setAppendItemName(int field, String value) {
|
||||
checkFrozen();
|
||||
appendItemNames[field] = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2682,13 +2682,15 @@ public class DecimalFormat extends NumberFormat {
|
|||
*
|
||||
* @param newSymbols
|
||||
* desired DecimalFormatSymbols
|
||||
* @return
|
||||
* @see DecimalFormatSymbols
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols) {
|
||||
public DecimalFormat setDecimalFormatSymbols(DecimalFormatSymbols newSymbols) {
|
||||
symbols = (DecimalFormatSymbols) newSymbols.clone();
|
||||
setCurrencyForSymbols();
|
||||
expandAffixes(null);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2732,12 +2734,14 @@ public class DecimalFormat extends NumberFormat {
|
|||
* Set the positive prefix.
|
||||
* <P>
|
||||
* Examples: +123, $123, sFr123
|
||||
* @return
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setPositivePrefix(String newValue) {
|
||||
public DecimalFormat setPositivePrefix(String newValue) {
|
||||
positivePrefix = newValue;
|
||||
posPrefixPattern = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2755,12 +2759,14 @@ public class DecimalFormat extends NumberFormat {
|
|||
* Set the negative prefix.
|
||||
* <P>
|
||||
* Examples: -123, ($123) (with negative suffix), sFr-123
|
||||
* @return
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setNegativePrefix(String newValue) {
|
||||
public DecimalFormat setNegativePrefix(String newValue) {
|
||||
negativePrefix = newValue;
|
||||
negPrefixPattern = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2778,12 +2784,14 @@ public class DecimalFormat extends NumberFormat {
|
|||
* Set the positive suffix.
|
||||
* <P>
|
||||
* Example: 123%
|
||||
* @return
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setPositiveSuffix(String newValue) {
|
||||
public DecimalFormat setPositiveSuffix(String newValue) {
|
||||
positiveSuffix = newValue;
|
||||
posSuffixPattern = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2801,12 +2809,14 @@ public class DecimalFormat extends NumberFormat {
|
|||
* Set the positive suffix.
|
||||
* <P>
|
||||
* Examples: 123%
|
||||
* @return
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setNegativeSuffix(String newValue) {
|
||||
public DecimalFormat setNegativeSuffix(String newValue) {
|
||||
negativeSuffix = newValue;
|
||||
negSuffixPattern = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2828,14 +2838,16 @@ public class DecimalFormat extends NumberFormat {
|
|||
* and the multiplier to be 1000.
|
||||
* <P>
|
||||
* Examples: with 100, 1.23 -> "123", and "123" -> 1.23
|
||||
* @return
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setMultiplier(int newValue) {
|
||||
public DecimalFormat setMultiplier(int newValue) {
|
||||
if (newValue == 0) {
|
||||
throw new IllegalArgumentException("Bad multiplier: " + newValue);
|
||||
}
|
||||
multiplier = newValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2859,6 +2871,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @param newValue
|
||||
* A positive rounding increment, or <code>null</code> or <code>BigDecimal(0.0)</code> to disable
|
||||
* rounding.
|
||||
* @return
|
||||
* @exception IllegalArgumentException
|
||||
* if <code>newValue</code> is < 0.0
|
||||
* @see #getRoundingIncrement
|
||||
|
@ -2866,12 +2879,13 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @see #setRoundingMode
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setRoundingIncrement(java.math.BigDecimal newValue) {
|
||||
public DecimalFormat setRoundingIncrement(java.math.BigDecimal newValue) {
|
||||
if (newValue == null) {
|
||||
setRoundingIncrement((BigDecimal) null);
|
||||
} else {
|
||||
setRoundingIncrement(new BigDecimal(newValue));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2880,6 +2894,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @param newValue
|
||||
* A positive rounding increment, or <code>null</code> or <code>BigDecimal(0.0)</code> to disable
|
||||
* rounding.
|
||||
* @return
|
||||
* @exception IllegalArgumentException
|
||||
* if <code>newValue</code> is < 0.0
|
||||
* @see #getRoundingIncrement
|
||||
|
@ -2887,7 +2902,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @see #setRoundingMode
|
||||
* @stable ICU 3.6
|
||||
*/
|
||||
public void setRoundingIncrement(BigDecimal newValue) {
|
||||
public DecimalFormat setRoundingIncrement(BigDecimal newValue) {
|
||||
int i = newValue == null ? 0 : newValue.compareTo(BigDecimal.ZERO);
|
||||
if (i < 0) {
|
||||
throw new IllegalArgumentException("Illegal rounding increment");
|
||||
|
@ -2898,6 +2913,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
setInternalRoundingIncrement(newValue);
|
||||
}
|
||||
setRoundingDouble();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2905,6 +2921,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
*
|
||||
* @param newValue
|
||||
* A positive rounding increment, or 0.0 to disable rounding.
|
||||
* @return
|
||||
* @exception IllegalArgumentException
|
||||
* if <code>newValue</code> is < 0.0
|
||||
* @see #getRoundingIncrement
|
||||
|
@ -2912,7 +2929,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @see #setRoundingMode
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setRoundingIncrement(double newValue) {
|
||||
public DecimalFormat setRoundingIncrement(double newValue) {
|
||||
if (newValue < 0.0) {
|
||||
throw new IllegalArgumentException("Illegal rounding increment");
|
||||
}
|
||||
|
@ -2928,6 +2945,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
}
|
||||
setInternalRoundingIncrement(new BigDecimal(newValue));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private void setRoundingDoubleReciprocal(double rawRoundedReciprocal) {
|
||||
|
@ -2959,6 +2977,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @param roundingMode
|
||||
* A rounding mode, between <code>BigDecimal.ROUND_UP</code> and
|
||||
* <code>BigDecimal.ROUND_UNNECESSARY</code>.
|
||||
* @return
|
||||
* @exception IllegalArgumentException
|
||||
* if <code>roundingMode</code> is unrecognized.
|
||||
* @see #setRoundingIncrement
|
||||
|
@ -2967,7 +2986,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @see java.math.BigDecimal
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setRoundingMode(int roundingMode) {
|
||||
public DecimalFormat setRoundingMode(int roundingMode) {
|
||||
if (roundingMode < BigDecimal.ROUND_UP || roundingMode > BigDecimal.ROUND_UNNECESSARY) {
|
||||
throw new IllegalArgumentException("Invalid rounding mode: " + roundingMode);
|
||||
}
|
||||
|
@ -2977,6 +2996,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
if (getRoundingIncrement() == null) {
|
||||
setRoundingIncrement(Math.pow(10.0, (double) -getMaximumFractionDigits()));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3000,6 +3020,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
*
|
||||
* @param width
|
||||
* the width to which to pad the result of <code>format()</code>, or zero to disable padding
|
||||
* @return
|
||||
* @exception IllegalArgumentException
|
||||
* if <code>width</code> is < 0
|
||||
* @see #getFormatWidth
|
||||
|
@ -3009,11 +3030,12 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @see #setPadPosition
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setFormatWidth(int width) {
|
||||
public DecimalFormat setFormatWidth(int width) {
|
||||
if (width < 0) {
|
||||
throw new IllegalArgumentException("Illegal format width");
|
||||
}
|
||||
formatWidth = width;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3037,6 +3059,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
*
|
||||
* @param padChar
|
||||
* the pad character
|
||||
* @return
|
||||
* @see #setFormatWidth
|
||||
* @see #getFormatWidth
|
||||
* @see #getPadCharacter
|
||||
|
@ -3044,8 +3067,9 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @see #setPadPosition
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setPadCharacter(char padChar) {
|
||||
public DecimalFormat setPadCharacter(char padChar) {
|
||||
pad = padChar;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3076,6 +3100,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @param padPos
|
||||
* the pad position, one of <code>PAD_BEFORE_PREFIX</code>, <code>PAD_AFTER_PREFIX</code>,
|
||||
* <code>PAD_BEFORE_SUFFIX</code>, or <code>PAD_AFTER_SUFFIX</code>.
|
||||
* @return
|
||||
* @exception IllegalArgumentException
|
||||
* if the pad position in unrecognized
|
||||
* @see #setFormatWidth
|
||||
|
@ -3089,11 +3114,12 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @see #PAD_AFTER_SUFFIX
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setPadPosition(int padPos) {
|
||||
public DecimalFormat setPadPosition(int padPos) {
|
||||
if (padPos < PAD_BEFORE_PREFIX || padPos > PAD_AFTER_SUFFIX) {
|
||||
throw new IllegalArgumentException("Illegal pad position");
|
||||
}
|
||||
padPosition = padPos;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3118,6 +3144,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
*
|
||||
* @param useScientific
|
||||
* true if this object formats and parses scientific notation
|
||||
* @return
|
||||
* @see #isScientificNotation
|
||||
* @see #getMinimumExponentDigits
|
||||
* @see #setMinimumExponentDigits
|
||||
|
@ -3125,8 +3152,9 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @see #setExponentSignAlwaysShown
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setScientificNotation(boolean useScientific) {
|
||||
public DecimalFormat setScientificNotation(boolean useScientific) {
|
||||
useExponentialNotation = useScientific;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3149,6 +3177,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
*
|
||||
* @param minExpDig
|
||||
* a value >= 1 indicating the fewest exponent digits that will be shown
|
||||
* @return
|
||||
* @exception IllegalArgumentException
|
||||
* if <code>minExpDig</code> < 1
|
||||
* @see #setScientificNotation
|
||||
|
@ -3158,11 +3187,12 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @see #setExponentSignAlwaysShown
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setMinimumExponentDigits(byte minExpDig) {
|
||||
public DecimalFormat setMinimumExponentDigits(byte minExpDig) {
|
||||
if (minExpDig < 1) {
|
||||
throw new IllegalArgumentException("Exponent digits must be >= 1");
|
||||
}
|
||||
minExponentDigits = minExpDig;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3187,6 +3217,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @param expSignAlways
|
||||
* true if the exponent is always prefixed with either the localized minus sign or the localized plus
|
||||
* sign, false if only negative exponents are prefixed with the localized minus sign.
|
||||
* @return
|
||||
* @see #setScientificNotation
|
||||
* @see #isScientificNotation
|
||||
* @see #setMinimumExponentDigits
|
||||
|
@ -3194,8 +3225,9 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @see #isExponentSignAlwaysShown
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setExponentSignAlwaysShown(boolean expSignAlways) {
|
||||
public DecimalFormat setExponentSignAlwaysShown(boolean expSignAlways) {
|
||||
exponentSignAlwaysShown = expSignAlways;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3214,14 +3246,16 @@ public class DecimalFormat extends NumberFormat {
|
|||
/**
|
||||
* Set the grouping size. Grouping size is the number of digits between grouping separators in the integer portion
|
||||
* of a number. For example, in the number "123,456.78", the grouping size is 3.
|
||||
* @return
|
||||
*
|
||||
* @see #getGroupingSize
|
||||
* @see NumberFormat#setGroupingUsed
|
||||
* @see DecimalFormatSymbols#setGroupingSeparator
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setGroupingSize(int newValue) {
|
||||
public DecimalFormat setGroupingSize(int newValue) {
|
||||
groupingSize = (byte) newValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3245,14 +3279,16 @@ public class DecimalFormat extends NumberFormat {
|
|||
/**
|
||||
* Set the secondary grouping size. If set to a value less than 1, then secondary grouping is turned off, and the
|
||||
* primary grouping size is used for all intervals, not just the least significant.
|
||||
* @return
|
||||
*
|
||||
* @see #getSecondaryGroupingSize
|
||||
* @see NumberFormat#setGroupingUsed
|
||||
* @see DecimalFormatSymbols#setGroupingSeparator
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setSecondaryGroupingSize(int newValue) {
|
||||
public DecimalFormat setSecondaryGroupingSize(int newValue) {
|
||||
groupingSize2 = (byte) newValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3292,13 +3328,15 @@ public class DecimalFormat extends NumberFormat {
|
|||
*
|
||||
* @param newValue
|
||||
* desired MathContext
|
||||
* @return
|
||||
* @see #mathContext
|
||||
* @see #getMathContext
|
||||
* @draft ICU 4.2
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public void setMathContextICU(MathContext newValue) {
|
||||
public DecimalFormat setMathContextICU(MathContext newValue) {
|
||||
mathContext = newValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3306,14 +3344,16 @@ public class DecimalFormat extends NumberFormat {
|
|||
*
|
||||
* @param newValue
|
||||
* desired MathContext
|
||||
* @return
|
||||
* @see #mathContext
|
||||
* @see #getMathContext
|
||||
* @draft ICU 4.2
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public void setMathContext(java.math.MathContext newValue) {
|
||||
public DecimalFormat setMathContext(java.math.MathContext newValue) {
|
||||
mathContext = new MathContext(newValue.getPrecision(), MathContext.SCIENTIFIC, false, (newValue
|
||||
.getRoundingMode()).ordinal());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3339,11 +3379,13 @@ public class DecimalFormat extends NumberFormat {
|
|||
*
|
||||
* <P>
|
||||
* Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
|
||||
* @return
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setDecimalSeparatorAlwaysShown(boolean newValue) {
|
||||
public DecimalFormat setDecimalSeparatorAlwaysShown(boolean newValue) {
|
||||
decimalSeparatorAlwaysShown = newValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3370,13 +3412,15 @@ public class DecimalFormat extends NumberFormat {
|
|||
*
|
||||
* @param newInfo
|
||||
* desired CurrencyPluralInfo
|
||||
* @return
|
||||
* @see CurrencyPluralInfo
|
||||
* @draft ICU 4.2
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public void setCurrencyPluralInfo(CurrencyPluralInfo newInfo) {
|
||||
public DecimalFormat setCurrencyPluralInfo(CurrencyPluralInfo newInfo) {
|
||||
currencyPluralInfo = (CurrencyPluralInfo) newInfo.clone();
|
||||
isReadyForParsing = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4038,11 +4082,13 @@ public class DecimalFormat extends NumberFormat {
|
|||
* <p>
|
||||
* In negative patterns, the minimum and maximum counts are ignored; these are presumed to be set in the positive
|
||||
* pattern.
|
||||
* @return
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void applyPattern(String pattern) {
|
||||
public DecimalFormat applyPattern(String pattern) {
|
||||
applyPattern(pattern, false);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4062,11 +4108,13 @@ public class DecimalFormat extends NumberFormat {
|
|||
* <p>
|
||||
* In negative patterns, the minimum and maximum counts are ignored; these are presumed to be set in the positive
|
||||
* pattern.
|
||||
* @return
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void applyLocalizedPattern(String pattern) {
|
||||
public DecimalFormat applyLocalizedPattern(String pattern) {
|
||||
applyPattern(pattern, true);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4583,23 +4631,27 @@ public class DecimalFormat extends NumberFormat {
|
|||
/**
|
||||
* Sets the maximum number of digits allowed in the integer portion of a number. This override limits the integer
|
||||
* digit count to 309.
|
||||
* @return
|
||||
*
|
||||
* @see NumberFormat#setMaximumIntegerDigits
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setMaximumIntegerDigits(int newValue) {
|
||||
public DecimalFormat setMaximumIntegerDigits(int newValue) {
|
||||
super.setMaximumIntegerDigits(Math.min(newValue, DOUBLE_INTEGER_DIGITS));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the minimum number of digits allowed in the integer portion of a number. This override limits the integer
|
||||
* digit count to 309.
|
||||
* @return
|
||||
*
|
||||
* @see NumberFormat#setMinimumIntegerDigits
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setMinimumIntegerDigits(int newValue) {
|
||||
public DecimalFormat setMinimumIntegerDigits(int newValue) {
|
||||
super.setMinimumIntegerDigits(Math.min(newValue, DOUBLE_INTEGER_DIGITS));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4631,9 +4683,10 @@ public class DecimalFormat extends NumberFormat {
|
|||
*
|
||||
* @param min
|
||||
* the fewest significant digits to be shown
|
||||
* @return
|
||||
* @stable ICU 3.0
|
||||
*/
|
||||
public void setMinimumSignificantDigits(int min) {
|
||||
public DecimalFormat setMinimumSignificantDigits(int min) {
|
||||
if (min < 1) {
|
||||
min = 1;
|
||||
}
|
||||
|
@ -4641,6 +4694,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
int max = Math.max(maxSignificantDigits, min);
|
||||
minSignificantDigits = min;
|
||||
maxSignificantDigits = max;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4650,9 +4704,10 @@ public class DecimalFormat extends NumberFormat {
|
|||
*
|
||||
* @param max
|
||||
* the most significant digits to be shown
|
||||
* @return
|
||||
* @stable ICU 3.0
|
||||
*/
|
||||
public void setMaximumSignificantDigits(int max) {
|
||||
public DecimalFormat setMaximumSignificantDigits(int max) {
|
||||
if (max < 1) {
|
||||
max = 1;
|
||||
}
|
||||
|
@ -4660,6 +4715,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
int min = Math.min(minSignificantDigits, max);
|
||||
minSignificantDigits = min;
|
||||
maxSignificantDigits = max;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4677,10 +4733,12 @@ public class DecimalFormat extends NumberFormat {
|
|||
*
|
||||
* @param useSignificantDigits
|
||||
* true to use significant digits, or false to use integer and fraction digit counts
|
||||
* @return
|
||||
* @stable ICU 3.0
|
||||
*/
|
||||
public void setSignificantDigitsUsed(boolean useSignificantDigits) {
|
||||
public DecimalFormat setSignificantDigitsUsed(boolean useSignificantDigits) {
|
||||
this.useSignificantDigits = useSignificantDigits;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4690,9 +4748,10 @@ public class DecimalFormat extends NumberFormat {
|
|||
*
|
||||
* @param theCurrency
|
||||
* new currency object to use. Must not be null.
|
||||
* @return
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public void setCurrency(Currency theCurrency) {
|
||||
public DecimalFormat setCurrency(Currency theCurrency) {
|
||||
// If we are a currency format, then modify our affixes to
|
||||
// encode the currency symbol for the given currency in our
|
||||
// locale, and adjust the decimal digits and rounding for the
|
||||
|
@ -4715,6 +4774,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
}
|
||||
expandAffixes(null);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4735,23 +4795,27 @@ public class DecimalFormat extends NumberFormat {
|
|||
/**
|
||||
* Sets the maximum number of digits allowed in the fraction portion of a number. This override limits the fraction
|
||||
* digit count to 340.
|
||||
* @return
|
||||
*
|
||||
* @see NumberFormat#setMaximumFractionDigits
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setMaximumFractionDigits(int newValue) {
|
||||
public DecimalFormat setMaximumFractionDigits(int newValue) {
|
||||
super.setMaximumFractionDigits(Math.min(newValue, DOUBLE_FRACTION_DIGITS));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the minimum number of digits allowed in the fraction portion of a number. This override limits the fraction
|
||||
* digit count to 340.
|
||||
* @return
|
||||
*
|
||||
* @see NumberFormat#setMinimumFractionDigits
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setMinimumFractionDigits(int newValue) {
|
||||
public DecimalFormat setMinimumFractionDigits(int newValue) {
|
||||
super.setMinimumFractionDigits(Math.min(newValue, DOUBLE_FRACTION_DIGITS));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4759,10 +4823,12 @@ public class DecimalFormat extends NumberFormat {
|
|||
*
|
||||
* @param value
|
||||
* true if {@link #parse(String, ParsePosition)} method returns BigDecimal.
|
||||
* @return
|
||||
* @stable ICU 3.6
|
||||
*/
|
||||
public void setParseBigDecimal(boolean value) {
|
||||
public DecimalFormat setParseBigDecimal(boolean value) {
|
||||
parseBigDecimal = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -119,12 +119,14 @@ public class DictionaryBasedBreakIterator extends RuleBasedBreakIterator {
|
|||
}
|
||||
|
||||
|
||||
/** @stable ICU 2.0 */
|
||||
public void setText(CharacterIterator newText) {
|
||||
/** @return
|
||||
* @stable ICU 2.0 */
|
||||
public DictionaryBasedBreakIterator setText(CharacterIterator newText) {
|
||||
super.setText(newText);
|
||||
cachedBreakPositions = null;
|
||||
fDictionaryCharCount = 0;
|
||||
positionInCache = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -458,10 +458,11 @@ public class MessageFormat extends UFormat implements BaseFormat<Object,StringBu
|
|||
* {@link #formatToCharacterIterator formatToCharacterIterator} methods.
|
||||
*
|
||||
* @param locale the locale to be used when creating or comparing subformats
|
||||
* @return
|
||||
* @stable ICU 3.0
|
||||
*/
|
||||
public void setLocale(Locale locale) {
|
||||
setLocale(ULocale.forLocale(locale));
|
||||
public MessageFormat setLocale(Locale locale) {
|
||||
return setLocale(ULocale.forLocale(locale));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -472,15 +473,17 @@ public class MessageFormat extends UFormat implements BaseFormat<Object,StringBu
|
|||
* {@link #formatToCharacterIterator formatToCharacterIterator} methods.
|
||||
*
|
||||
* @param locale the locale to be used when creating or comparing subformats
|
||||
* @return
|
||||
* @stable ICU 3.2
|
||||
*/
|
||||
public void setLocale(ULocale locale) {
|
||||
public MessageFormat setLocale(ULocale locale) {
|
||||
/* Save the pattern, and then reapply so that */
|
||||
/* we pick up any changes in locale specific */
|
||||
/* elements */
|
||||
String existingPattern = toPattern(); /*ibm.3550*/
|
||||
this.ulocale = locale;
|
||||
applyPattern(existingPattern); /*ibm.3550*/
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -514,10 +517,11 @@ public class MessageFormat extends UFormat implements BaseFormat<Object,StringBu
|
|||
* mixing them is not allowed.
|
||||
*
|
||||
* @param pttrn the pattern for this message format
|
||||
* @return
|
||||
* @throws IllegalArgumentException if the pattern is invalid
|
||||
* @stable ICU 3.0
|
||||
*/
|
||||
public void applyPattern(String pttrn) {
|
||||
public MessageFormat applyPattern(String pttrn) {
|
||||
StringBuffer[] segments = new StringBuffer[4];
|
||||
for (int i = 0; i < segments.length; ++i) {
|
||||
segments[i] = new StringBuffer();
|
||||
|
@ -584,6 +588,7 @@ public class MessageFormat extends UFormat implements BaseFormat<Object,StringBu
|
|||
throw new IllegalArgumentException("Unmatched braces in the pattern.");
|
||||
}
|
||||
this.pattern = segments[0].toString();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
@ -696,13 +701,14 @@ public class MessageFormat extends UFormat implements BaseFormat<Object,StringBu
|
|||
*
|
||||
* @param newFormats
|
||||
* the new formats to use
|
||||
* @return
|
||||
* @throws NullPointerException
|
||||
* if <code>newFormats</code> is null
|
||||
* @throws IllegalArgumentException
|
||||
* if this formatter uses named arguments
|
||||
* @stable ICU 3.0
|
||||
*/
|
||||
public void setFormatsByArgumentIndex(Format[] newFormats) {
|
||||
public MessageFormat setFormatsByArgumentIndex(Format[] newFormats) {
|
||||
if (!argumentNamesAreNumeric) {
|
||||
throw new IllegalArgumentException(
|
||||
"This method is not available in MessageFormat objects " +
|
||||
|
@ -714,6 +720,7 @@ public class MessageFormat extends UFormat implements BaseFormat<Object,StringBu
|
|||
formats[i] = newFormats[j];
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -735,15 +742,17 @@ public class MessageFormat extends UFormat implements BaseFormat<Object,StringBu
|
|||
*
|
||||
* @param newFormats a map from String to Format providing new
|
||||
* formats for named arguments.
|
||||
* @return
|
||||
* @stable ICU 3.8
|
||||
*/
|
||||
public void setFormatsByArgumentName(Map<String, Format> newFormats) {
|
||||
public MessageFormat setFormatsByArgumentName(Map<String, Format> newFormats) {
|
||||
for (int i = 0; i <= maxOffset; i++) {
|
||||
if (newFormats.containsKey(argumentNames[i])) {
|
||||
Format f = newFormats.get(argumentNames[i]);
|
||||
formats[i] = f;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -766,10 +775,11 @@ public class MessageFormat extends UFormat implements BaseFormat<Object,StringBu
|
|||
* the <code>parse</code> methods.
|
||||
*
|
||||
* @param newFormats the new formats to use
|
||||
* @return
|
||||
* @exception NullPointerException if <code>newFormats</code> is null
|
||||
* @stable ICU 3.0
|
||||
*/
|
||||
public void setFormats(Format[] newFormats) {
|
||||
public MessageFormat setFormats(Format[] newFormats) {
|
||||
int runsToCopy = newFormats.length;
|
||||
if (runsToCopy > maxOffset + 1) {
|
||||
runsToCopy = maxOffset + 1;
|
||||
|
@ -777,6 +787,7 @@ public class MessageFormat extends UFormat implements BaseFormat<Object,StringBu
|
|||
for (int i = 0; i < runsToCopy; i++) {
|
||||
formats[i] = newFormats[i];
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -800,11 +811,12 @@ public class MessageFormat extends UFormat implements BaseFormat<Object,StringBu
|
|||
* the argument index for which to use the new format
|
||||
* @param newFormat
|
||||
* the new format to use
|
||||
* @return
|
||||
* @exception IllegalArgumentException
|
||||
* if alphanumeric arguments where used in MessageFormat.
|
||||
* @stable ICU 3.0
|
||||
*/
|
||||
public void setFormatByArgumentIndex(int argumentIndex, Format newFormat) {
|
||||
public MessageFormat setFormatByArgumentIndex(int argumentIndex, Format newFormat) {
|
||||
if (!argumentNamesAreNumeric) {
|
||||
throw new IllegalArgumentException(
|
||||
"This method is not available in MessageFormat objects " +
|
||||
|
@ -815,6 +827,7 @@ public class MessageFormat extends UFormat implements BaseFormat<Object,StringBu
|
|||
formats[j] = newFormat;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -834,14 +847,16 @@ public class MessageFormat extends UFormat implements BaseFormat<Object,StringBu
|
|||
*
|
||||
* @param argumentName the name of the argument to change
|
||||
* @param newFormat the new format to use
|
||||
* @return
|
||||
* @stable ICU 3.8
|
||||
*/
|
||||
public void setFormatByArgumentName(String argumentName, Format newFormat) {
|
||||
public MessageFormat setFormatByArgumentName(String argumentName, Format newFormat) {
|
||||
for (int i = 0; i <= maxOffset; ++i) {
|
||||
if (argumentName.equals(argumentNames[i])) {
|
||||
formats[i] = newFormat;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -858,12 +873,14 @@ public class MessageFormat extends UFormat implements BaseFormat<Object,StringBu
|
|||
*
|
||||
* @param formatElementIndex the index of a format element within the pattern
|
||||
* @param newFormat the format to use for the specified format element
|
||||
* @return
|
||||
* @exception ArrayIndexOutOfBoundsException if formatElementIndex is equal to or
|
||||
* larger than the number of format elements in the pattern string
|
||||
* @stable ICU 3.0
|
||||
*/
|
||||
public void setFormat(int formatElementIndex, Format newFormat) {
|
||||
public MessageFormat setFormat(int formatElementIndex, Format newFormat) {
|
||||
formats[formatElementIndex] = newFormat;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1836,12 +1836,14 @@ public final class Normalizer implements Cloneable {
|
|||
/**
|
||||
* Reset the index to the beginning of the text.
|
||||
* This is equivalent to setIndexOnly(startIndex)).
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void reset() {
|
||||
public Normalizer reset() {
|
||||
text.setIndex(0);
|
||||
currentIndex=nextIndex=0;
|
||||
clearBuffer();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1851,12 +1853,14 @@ public final class Normalizer implements Cloneable {
|
|||
* specified here.
|
||||
*
|
||||
* @param index the desired index in the input text.
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setIndexOnly(int index) {
|
||||
public Normalizer setIndexOnly(int index) {
|
||||
text.setIndex(index);
|
||||
currentIndex=nextIndex=index; // validates index
|
||||
clearBuffer();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2005,12 +2009,14 @@ public final class Normalizer implements Cloneable {
|
|||
* <li>{@link #NONE} - Do nothing but return characters
|
||||
* from the underlying input text.
|
||||
* </ul>
|
||||
* @return
|
||||
*
|
||||
* @see #getMode
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setMode(Mode newMode) {
|
||||
public Normalizer setMode(Mode newMode) {
|
||||
mode = newMode;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Return the basic operation performed by this <tt>Normalizer</tt>
|
||||
|
@ -2035,16 +2041,18 @@ public final class Normalizer implements Cloneable {
|
|||
* @param option the option whose value is to be set.
|
||||
* @param value the new setting for the option. Use <tt>true</tt> to
|
||||
* turn the option on and <tt>false</tt> to turn it off.
|
||||
* @return
|
||||
*
|
||||
* @see #getOption
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
public void setOption(int option,boolean value) {
|
||||
public Normalizer setOption(int option,boolean value) {
|
||||
if (value) {
|
||||
options |= option;
|
||||
} else {
|
||||
options &= (~option);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2096,80 +2104,85 @@ public final class Normalizer implements Cloneable {
|
|||
* Set the input text over which this <tt>Normalizer</tt> will iterate.
|
||||
* The iteration position is set to the beginning of the input text->
|
||||
* @param newText The new string to be normalized.
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setText(StringBuffer newText) {
|
||||
public Normalizer setText(StringBuffer newText) {
|
||||
|
||||
UCharacterIterator newIter = UCharacterIterator.getInstance(newText);
|
||||
if (newIter == null) {
|
||||
throw new IllegalStateException("Could not create a new UCharacterIterator");
|
||||
}
|
||||
text = newIter;
|
||||
reset();
|
||||
return reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the input text over which this <tt>Normalizer</tt> will iterate.
|
||||
* The iteration position is set to the beginning of the input text->
|
||||
* @param newText The new string to be normalized.
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setText(char[] newText) {
|
||||
public Normalizer setText(char[] newText) {
|
||||
|
||||
UCharacterIterator newIter = UCharacterIterator.getInstance(newText);
|
||||
if (newIter == null) {
|
||||
throw new IllegalStateException("Could not create a new UCharacterIterator");
|
||||
}
|
||||
text = newIter;
|
||||
reset();
|
||||
return reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the input text over which this <tt>Normalizer</tt> will iterate.
|
||||
* The iteration position is set to the beginning of the input text->
|
||||
* @param newText The new string to be normalized.
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setText(String newText) {
|
||||
public Normalizer setText(String newText) {
|
||||
|
||||
UCharacterIterator newIter = UCharacterIterator.getInstance(newText);
|
||||
if (newIter == null) {
|
||||
throw new IllegalStateException("Could not create a new UCharacterIterator");
|
||||
}
|
||||
text = newIter;
|
||||
reset();
|
||||
return reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the input text over which this <tt>Normalizer</tt> will iterate.
|
||||
* The iteration position is set to the beginning of the input text->
|
||||
* @param newText The new string to be normalized.
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setText(CharacterIterator newText) {
|
||||
public Normalizer setText(CharacterIterator newText) {
|
||||
|
||||
UCharacterIterator newIter = UCharacterIterator.getInstance(newText);
|
||||
if (newIter == null) {
|
||||
throw new IllegalStateException("Could not create a new UCharacterIterator");
|
||||
}
|
||||
text = newIter;
|
||||
reset();
|
||||
return reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the input text over which this <tt>Normalizer</tt> will iterate.
|
||||
* The iteration position is set to the beginning of the string.
|
||||
* @param newText The new string to be normalized.
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setText(UCharacterIterator newText) {
|
||||
public Normalizer setText(UCharacterIterator newText) {
|
||||
try{
|
||||
UCharacterIterator newIter = (UCharacterIterator)newText.clone();
|
||||
if (newIter == null) {
|
||||
throw new IllegalStateException("Could not create a new UCharacterIterator");
|
||||
}
|
||||
text = newIter;
|
||||
reset();
|
||||
return reset();
|
||||
}catch(CloneNotSupportedException e) {
|
||||
throw new IllegalStateException("Could not clone the UCharacterIterator");
|
||||
}
|
||||
|
|
|
@ -461,11 +461,13 @@ public abstract class NumberFormat extends UFormat {
|
|||
/**
|
||||
* Sets whether or not numbers should be parsed as integers only.
|
||||
* @param value true if this should parse integers only
|
||||
* @return
|
||||
* @see #isParseIntegerOnly
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setParseIntegerOnly(boolean value) {
|
||||
public NumberFormat setParseIntegerOnly(boolean value) {
|
||||
parseIntegerOnly = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -484,11 +486,13 @@ public abstract class NumberFormat extends UFormat {
|
|||
* When strict parsing is off, leading zeros and all grouping separators are ignored.
|
||||
* This is the default behavior.
|
||||
* @param value True to enable strict parsing. Default is false.
|
||||
* @return
|
||||
* @see #isParseStrict
|
||||
* @stable ICU 3.6
|
||||
*/
|
||||
public void setParseStrict(boolean value) {
|
||||
public NumberFormat setParseStrict(boolean value) {
|
||||
parseStrict = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1035,10 +1039,12 @@ public abstract class NumberFormat extends UFormat {
|
|||
* affects both parsing and formatting.
|
||||
* @see #isGroupingUsed
|
||||
* @param newValue true to use grouping.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setGroupingUsed(boolean newValue) {
|
||||
public NumberFormat setGroupingUsed(boolean newValue) {
|
||||
groupingUsed = newValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1063,13 +1069,15 @@ public abstract class NumberFormat extends UFormat {
|
|||
* @param newValue the maximum number of integer digits to be shown; if
|
||||
* less than zero, then zero is used. Subclasses might enforce an
|
||||
* upper limit to this value appropriate to the numeric type being formatted.
|
||||
* @return
|
||||
* @see #getMaximumIntegerDigits
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setMaximumIntegerDigits(int newValue) {
|
||||
public NumberFormat setMaximumIntegerDigits(int newValue) {
|
||||
maximumIntegerDigits = Math.max(0,newValue);
|
||||
if (minimumIntegerDigits > maximumIntegerDigits)
|
||||
minimumIntegerDigits = maximumIntegerDigits;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1095,13 +1103,15 @@ public abstract class NumberFormat extends UFormat {
|
|||
* @param newValue the minimum number of integer digits to be shown; if
|
||||
* less than zero, then zero is used. Subclasses might enforce an
|
||||
* upper limit to this value appropriate to the numeric type being formatted.
|
||||
* @return
|
||||
* @see #getMinimumIntegerDigits
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setMinimumIntegerDigits(int newValue) {
|
||||
public NumberFormat setMinimumIntegerDigits(int newValue) {
|
||||
minimumIntegerDigits = Math.max(0,newValue);
|
||||
if (minimumIntegerDigits > maximumIntegerDigits)
|
||||
maximumIntegerDigits = minimumIntegerDigits;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1127,13 +1137,15 @@ public abstract class NumberFormat extends UFormat {
|
|||
* @param newValue the maximum number of fraction digits to be shown; if
|
||||
* less than zero, then zero is used. The concrete subclass may enforce an
|
||||
* upper limit to this value appropriate to the numeric type being formatted.
|
||||
* @return
|
||||
* @see #getMaximumFractionDigits
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setMaximumFractionDigits(int newValue) {
|
||||
public NumberFormat setMaximumFractionDigits(int newValue) {
|
||||
maximumFractionDigits = Math.max(0,newValue);
|
||||
if (maximumFractionDigits < minimumFractionDigits)
|
||||
minimumFractionDigits = maximumFractionDigits;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1159,13 +1171,15 @@ public abstract class NumberFormat extends UFormat {
|
|||
* @param newValue the minimum number of fraction digits to be shown; if
|
||||
* less than zero, then zero is used. Subclasses might enforce an
|
||||
* upper limit to this value appropriate to the numeric type being formatted.
|
||||
* @return
|
||||
* @see #getMinimumFractionDigits
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setMinimumFractionDigits(int newValue) {
|
||||
public NumberFormat setMinimumFractionDigits(int newValue) {
|
||||
minimumFractionDigits = Math.max(0,newValue);
|
||||
if (maximumFractionDigits < minimumFractionDigits)
|
||||
maximumFractionDigits = minimumFractionDigits;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1176,10 +1190,12 @@ public abstract class NumberFormat extends UFormat {
|
|||
* currency format.
|
||||
* @param theCurrency new currency object to use. May be null for
|
||||
* some subclasses.
|
||||
* @return
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
public void setCurrency(Currency theCurrency) {
|
||||
public NumberFormat setCurrency(Currency theCurrency) {
|
||||
currency = theCurrency;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1229,10 +1245,11 @@ public abstract class NumberFormat extends UFormat {
|
|||
* @param roundingMode A rounding mode, between
|
||||
* <code>BigDecimal.ROUND_UP</code> and
|
||||
* <code>BigDecimal.ROUND_UNNECESSARY</code>.
|
||||
* @return
|
||||
* @see #getRoundingMode()
|
||||
* @stable ICU 4.0
|
||||
*/
|
||||
public void setRoundingMode(int roundingMode) {
|
||||
public NumberFormat setRoundingMode(int roundingMode) {
|
||||
throw new UnsupportedOperationException("setRoundingMode must be implemented by the subclass implementation.");
|
||||
}
|
||||
|
||||
|
|
|
@ -315,10 +315,11 @@ public class PluralFormat extends UFormat {
|
|||
* Patterns and their interpretation are specified in the class description.
|
||||
*
|
||||
* @param pttrn the pattern for this plural format.
|
||||
* @return
|
||||
* @throws IllegalArgumentException if the pattern is invalid.
|
||||
* @stable ICU 3.8
|
||||
*/
|
||||
public void applyPattern(String pttrn) {
|
||||
public PluralFormat applyPattern(String pttrn) {
|
||||
pttrn = pttrn.trim();
|
||||
|
||||
this.pattern = pttrn;
|
||||
|
@ -403,6 +404,7 @@ public class PluralFormat extends UFormat {
|
|||
"Malformed formatting expression. Braces do not match.");
|
||||
}
|
||||
checkSufficientDefinition();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -511,13 +513,15 @@ public class PluralFormat extends UFormat {
|
|||
* @param ulocale the <code>ULocale</code> used to configure the
|
||||
* formatter. If <code>ulocale</code> is <code>null</code>, the
|
||||
* default locale will be used.
|
||||
* @return
|
||||
* @stable ICU 3.8
|
||||
*/
|
||||
public void setLocale(ULocale ulocale) {
|
||||
public PluralFormat setLocale(ULocale ulocale) {
|
||||
if (ulocale == null) {
|
||||
ulocale = ULocale.getDefault();
|
||||
}
|
||||
init(null, ulocale);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -525,10 +529,12 @@ public class PluralFormat extends UFormat {
|
|||
* call this if you want a different number format than the default
|
||||
* formatter for the locale.
|
||||
* @param format the number format to use.
|
||||
* @return
|
||||
* @stable ICU 3.8
|
||||
*/
|
||||
public void setNumberFormat(NumberFormat format) {
|
||||
public PluralFormat setNumberFormat(NumberFormat format) {
|
||||
numberFormat = format;
|
||||
return this;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -103,12 +103,14 @@ class Quantifier implements UnicodeMatcher {
|
|||
* characters that may be matched by this object into the given
|
||||
* set.
|
||||
* @param toUnionTo the set into which to union the source characters
|
||||
* @return
|
||||
* @returns a reference to toUnionTo
|
||||
*/
|
||||
public void addMatchSetTo(UnicodeSet toUnionTo) {
|
||||
public Quantifier addMatchSetTo(UnicodeSet toUnionTo) {
|
||||
if (maxCount > 0) {
|
||||
matcher.addMatchSetTo(toUnionTo);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -103,7 +103,7 @@ public interface Replaceable {
|
|||
* @param dstStart the start offset in the destination array.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
void getChars(int srcStart, int srcLimit, char dst[], int dstStart);
|
||||
Replaceable getChars(int srcStart, int srcLimit, char dst[], int dstStart);
|
||||
|
||||
/**
|
||||
* Replaces a substring of this object with the given text.
|
||||
|
@ -123,7 +123,7 @@ public interface Replaceable {
|
|||
* to <code>limit - 1</code>
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
void replace(int start, int limit, String text);
|
||||
Replaceable replace(int start, int limit, String text);
|
||||
|
||||
/**
|
||||
* Replaces a substring of this object with the given text.
|
||||
|
@ -146,7 +146,7 @@ public interface Replaceable {
|
|||
* @param charsLen the number of characters of <code>chars</code>.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
void replace(int start, int limit, char[] chars,
|
||||
Replaceable replace(int start, int limit, char[] chars,
|
||||
int charsStart, int charsLen);
|
||||
// Note: We use length rather than limit to conform to StringBuffer
|
||||
// and System.arraycopy.
|
||||
|
@ -172,7 +172,7 @@ public interface Replaceable {
|
|||
* dest >= limit</code>.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
void copy(int start, int limit, int dest);
|
||||
Replaceable copy(int start, int limit, int dest);
|
||||
|
||||
/**
|
||||
* Returns true if this object contains metadata. If a
|
||||
|
|
|
@ -123,12 +123,14 @@ public class ReplaceableString implements Replaceable {
|
|||
* <code>start <= limit <= length()</code>.
|
||||
* @param dst the destination array.
|
||||
* @param dstStart the start offset in the destination array.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void getChars(int srcStart, int srcLimit, char dst[], int dstStart) {
|
||||
public ReplaceableString getChars(int srcStart, int srcLimit, char dst[], int dstStart) {
|
||||
if (srcStart != srcLimit) {
|
||||
buf.getChars(srcStart, srcLimit, dst, dstStart);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,10 +142,12 @@ public class ReplaceableString implements Replaceable {
|
|||
* <= length()</code>.
|
||||
* @param text new text to replace characters <code>start</code> to
|
||||
* <code>limit - 1</code>
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void replace(int start, int limit, String text) {
|
||||
public ReplaceableString replace(int start, int limit, String text) {
|
||||
buf.replace(start, limit, text);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -157,12 +161,14 @@ public class ReplaceableString implements Replaceable {
|
|||
* @param charsStart the beginning index into <code>chars</code>,
|
||||
* inclusive; <code>0 <= start <= limit</code>.
|
||||
* @param charsLen the number of characters of <code>chars</code>.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void replace(int start, int limit, char[] chars,
|
||||
public ReplaceableString replace(int start, int limit, char[] chars,
|
||||
int charsStart, int charsLen) {
|
||||
buf.delete(start, limit);
|
||||
buf.insert(start, chars, charsStart, charsLen);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,15 +184,17 @@ public class ReplaceableString implements Replaceable {
|
|||
* <code>start..limit-1</code> will be copied to <code>dest</code>.
|
||||
* Implementations of this method may assume that <code>dest <= start ||
|
||||
* dest >= limit</code>.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void copy(int start, int limit, int dest) {
|
||||
public ReplaceableString copy(int start, int limit, int dest) {
|
||||
if (start == limit && start >= 0 && start <= buf.length()) {
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
char[] text = new char[limit - start];
|
||||
getChars(start, limit, text, 0);
|
||||
replace(dest, dest, text, 0, limit - start);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -786,11 +786,13 @@ public int getRuleStatusVec(int[] fillInArray) {
|
|||
* Set the iterator to analyze a new piece of text. This function resets
|
||||
* the current iteration position to the beginning of the text.
|
||||
* @param newText An iterator over the text to analyze.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setText(CharacterIterator newText) {
|
||||
public RuleBasedBreakIterator setText(CharacterIterator newText) {
|
||||
fText = newText;
|
||||
this.first();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1247,12 +1247,14 @@ public class RuleBasedNumberFormat extends NumberFormat {
|
|||
* it is available on the classpath. Otherwise this will have no effect.
|
||||
*
|
||||
* @param enabled If true, turns lenient-parse mode on; if false, turns it off.
|
||||
* @return
|
||||
* @see RbnfLenientScanner
|
||||
* @see RbnfLenientScannerProvider
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setLenientParseMode(boolean enabled) {
|
||||
public RuleBasedNumberFormat setLenientParseMode(boolean enabled) {
|
||||
lenientParse = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1271,12 +1273,14 @@ public class RuleBasedNumberFormat extends NumberFormat {
|
|||
* {@link #setLenientParseMode}
|
||||
* has no effect. This is necessary to decouple collation from format code.
|
||||
* @param scannerProvider the provider
|
||||
* @return
|
||||
* @see #setLenientParseMode
|
||||
* @see #getLenientScannerProvider
|
||||
* @draft ICU 4.4
|
||||
*/
|
||||
public void setLenientScannerProvider(RbnfLenientScannerProvider scannerProvider) {
|
||||
public RuleBasedNumberFormat setLenientScannerProvider(RbnfLenientScannerProvider scannerProvider) {
|
||||
this.scannerProvider = scannerProvider;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1312,10 +1316,11 @@ public class RuleBasedNumberFormat extends NumberFormat {
|
|||
* Override the default rule set to use. If ruleSetName is null, reset
|
||||
* to the initial default rule set.
|
||||
* @param ruleSetName the name of the rule set, or null to reset the initial default.
|
||||
* @return
|
||||
* @throws IllegalArgumentException if ruleSetName is not the name of a public ruleset.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setDefaultRuleSet(String ruleSetName) {
|
||||
public RuleBasedNumberFormat setDefaultRuleSet(String ruleSetName) {
|
||||
if (ruleSetName == null) {
|
||||
if (publicRuleSetNames.length > 0) {
|
||||
defaultRuleSet = findRuleSet(publicRuleSetNames[0]);
|
||||
|
@ -1329,7 +1334,7 @@ public class RuleBasedNumberFormat extends NumberFormat {
|
|||
currentName.equals("%duration")) {
|
||||
|
||||
defaultRuleSet = ruleSets[n];
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1346,6 +1351,7 @@ public class RuleBasedNumberFormat extends NumberFormat {
|
|||
} else {
|
||||
defaultRuleSet = findRuleSet(ruleSetName);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -147,12 +147,13 @@ public abstract class SearchIterator
|
|||
* This method clears any previous match.
|
||||
* </p>
|
||||
* @param position position from which to start the next search
|
||||
* @return
|
||||
* @exception IndexOutOfBoundsException thrown if argument position is out
|
||||
* of the target text range.
|
||||
* @see #getIndex
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setIndex(int position) {
|
||||
public SearchIterator setIndex(int position) {
|
||||
if (position < targetText.getBeginIndex()
|
||||
|| position > targetText.getEndIndex()) {
|
||||
throw new IndexOutOfBoundsException(
|
||||
|
@ -162,6 +163,7 @@ public abstract class SearchIterator
|
|||
m_setOffset_ = position;
|
||||
m_reset_ = false;
|
||||
matchLength = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -173,12 +175,14 @@ public abstract class SearchIterator
|
|||
* The default setting of this property is false
|
||||
* </p>
|
||||
* @param allowOverlap flag indicator if overlapping matches are allowed
|
||||
* @return
|
||||
* @see #isOverlapping
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void setOverlapping(boolean allowOverlap)
|
||||
public SearchIterator setOverlapping(boolean allowOverlap)
|
||||
{
|
||||
m_isOverlap_ = allowOverlap;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -189,16 +193,18 @@ public abstract class SearchIterator
|
|||
* See class documentation for more information.
|
||||
* @param breakiter A BreakIterator that will be used to restrict the
|
||||
* points at which matches are detected.
|
||||
* @return
|
||||
* @see #getBreakIterator
|
||||
* @see BreakIterator
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setBreakIterator(BreakIterator breakiter)
|
||||
public SearchIterator setBreakIterator(BreakIterator breakiter)
|
||||
{
|
||||
breakIterator = breakiter;
|
||||
if (breakIterator != null) {
|
||||
breakIterator.setText(targetText);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -206,12 +212,13 @@ public abstract class SearchIterator
|
|||
* the start of the text string. This method is useful if you want to
|
||||
* reuse an iterator to search within a different body of text.
|
||||
* @param text new text iterator to look for match,
|
||||
* @return
|
||||
* @exception IllegalArgumentException thrown when text is null or has
|
||||
* 0 length
|
||||
* @see #getTarget
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
public void setTarget(CharacterIterator text)
|
||||
public SearchIterator setTarget(CharacterIterator text)
|
||||
{
|
||||
if (text == null || text.getEndIndex() == text.getIndex()) {
|
||||
throw new IllegalArgumentException("Illegal null or empty text");
|
||||
|
@ -225,6 +232,7 @@ public abstract class SearchIterator
|
|||
if (breakIterator != null) {
|
||||
breakIterator.setText(targetText);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
// public getters ----------------------------------------------------
|
||||
|
@ -514,9 +522,10 @@ public abstract class SearchIterator
|
|||
* start of the target text. Otherwise, if a backwards iteration is initiated,
|
||||
* the next search will begin at the end of the target text.
|
||||
* </p>
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void reset()
|
||||
public SearchIterator reset()
|
||||
{
|
||||
// reset is setting the attributes that are already in string search
|
||||
matchLength = 0;
|
||||
|
@ -525,6 +534,7 @@ public abstract class SearchIterator
|
|||
m_isForwardSearching_ = true;
|
||||
m_reset_ = true;
|
||||
m_setOffset_ = DONE;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -596,10 +596,12 @@ 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>.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void set2DigitYearStart(Date startDate) {
|
||||
public SimpleDateFormat set2DigitYearStart(Date startDate) {
|
||||
parseAmbiguousDatesAsAfter(startDate);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1520,12 +1522,14 @@ public class SimpleDateFormat extends DateFormat {
|
|||
|
||||
/**
|
||||
* Overrides superclass method
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setNumberFormat(NumberFormat newNumberFormat) {
|
||||
public SimpleDateFormat setNumberFormat(NumberFormat newNumberFormat) {
|
||||
// Override this method to update local zero padding number formatter
|
||||
super.setNumberFormat(newNumberFormat);
|
||||
initLocalZeroPaddingNumberFormat();
|
||||
return this;
|
||||
}
|
||||
|
||||
private void initLocalZeroPaddingNumberFormat() {
|
||||
|
@ -1607,10 +1611,11 @@ public class SimpleDateFormat extends DateFormat {
|
|||
|
||||
/**
|
||||
* Overrides DateFormat
|
||||
* @return
|
||||
* @see DateFormat
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void parse(String text, Calendar cal, ParsePosition parsePos)
|
||||
public SimpleDateFormat parse(String text, Calendar cal, ParsePosition parsePos)
|
||||
{
|
||||
TimeZone backupTZ = null;
|
||||
Calendar resultCal = null;
|
||||
|
@ -1688,7 +1693,7 @@ public class SimpleDateFormat extends DateFormat {
|
|||
if (backupTZ != null) {
|
||||
calendar.setTimeZone(backupTZ);
|
||||
}
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
i = numericFieldStart;
|
||||
pos = numericStartPos;
|
||||
|
@ -1708,7 +1713,7 @@ public class SimpleDateFormat extends DateFormat {
|
|||
if (backupTZ != null) {
|
||||
calendar.setTimeZone(backupTZ);
|
||||
}
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1746,7 +1751,7 @@ public class SimpleDateFormat extends DateFormat {
|
|||
if (backupTZ != null) {
|
||||
calendar.setTimeZone(backupTZ);
|
||||
}
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
++i;
|
||||
|
@ -1909,7 +1914,7 @@ public class SimpleDateFormat extends DateFormat {
|
|||
if (backupTZ != null) {
|
||||
calendar.setTimeZone(backupTZ);
|
||||
}
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
// Set the parsed result if local calendar is used
|
||||
// instead of the input calendar
|
||||
|
@ -1921,6 +1926,7 @@ public class SimpleDateFormat extends DateFormat {
|
|||
if (backupTZ != null) {
|
||||
calendar.setTimeZone(backupTZ);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2567,25 +2573,29 @@ public class SimpleDateFormat extends DateFormat {
|
|||
|
||||
/**
|
||||
* Apply the given unlocalized pattern string to this date format.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void applyPattern(String pat)
|
||||
public SimpleDateFormat applyPattern(String pat)
|
||||
{
|
||||
this.pattern = pat;
|
||||
setLocale(null, null);
|
||||
// reset parsed pattern items
|
||||
patternItems = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the given localized pattern string to this date format.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void applyLocalizedPattern(String pat) {
|
||||
public SimpleDateFormat applyLocalizedPattern(String pat) {
|
||||
this.pattern = translatePattern(pat,
|
||||
formatData.localPatternChars,
|
||||
DateFormatSymbols.patternChars);
|
||||
setLocale(null, null);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2602,12 +2612,14 @@ public class SimpleDateFormat extends DateFormat {
|
|||
/**
|
||||
* Allows you to set the date/time formatting data.
|
||||
* @param newFormatSymbols the new symbols
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols)
|
||||
public SimpleDateFormat setDateFormatSymbols(DateFormatSymbols newFormatSymbols)
|
||||
{
|
||||
this.formatData = (DateFormatSymbols)newFormatSymbols.clone();
|
||||
gmtfmtCache = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2006, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -90,9 +90,10 @@ public final class StringCharacterIterator implements CharacterIterator
|
|||
* is called.
|
||||
*
|
||||
* @param text The String to be iterated over
|
||||
* @return
|
||||
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
|
||||
*/
|
||||
public void setText(String text) {
|
||||
public StringCharacterIterator setText(String text) {
|
||||
if (text == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
@ -100,6 +101,7 @@ public final class StringCharacterIterator implements CharacterIterator
|
|||
this.begin = 0;
|
||||
this.end = text.length();
|
||||
this.pos = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -265,22 +265,25 @@ public abstract class UCharacterIterator
|
|||
* supplied
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
public abstract void setIndex(int index);
|
||||
public abstract UCharacterIterator setIndex(int index);
|
||||
|
||||
/**
|
||||
* Sets the current index to the limit.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
public void setToLimit() {
|
||||
public UCharacterIterator setToLimit() {
|
||||
setIndex(getLength());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current index to the start.
|
||||
* @return
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
public void setToStart() {
|
||||
public UCharacterIterator setToStart() {
|
||||
setIndex(0);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -73,12 +73,13 @@ public abstract class UFormat extends Format implements BaseFormat<Object,String
|
|||
* data, or null
|
||||
* @param actual the locale containing data used to construct this
|
||||
* object, or null
|
||||
* @return
|
||||
* @see com.ibm.icu.util.ULocale
|
||||
* @see com.ibm.icu.util.ULocale#VALID_LOCALE
|
||||
* @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE
|
||||
* @internal
|
||||
*/
|
||||
final void setLocale(ULocale valid, ULocale actual) {
|
||||
final UFormat setLocale(ULocale valid, ULocale actual) {
|
||||
// Change the following to an assertion later
|
||||
if ((valid == null) != (actual == null)) {
|
||||
///CLOVER:OFF
|
||||
|
@ -89,6 +90,7 @@ public abstract class UFormat extends Format implements BaseFormat<Object,String
|
|||
// the same level or less specific than the valid locale.
|
||||
this.validLocale = valid;
|
||||
this.actualLocale = actual;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2594,12 +2594,13 @@ public final class UTF16 {
|
|||
* true for code point compare, false for code unit compare
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
public void setCodePointCompare(boolean flag) {
|
||||
public StringComparator setCodePointCompare(boolean flag) {
|
||||
if (flag) {
|
||||
m_codePointCompare_ = Normalizer.COMPARE_CODE_POINT_ORDER;
|
||||
} else {
|
||||
m_codePointCompare_ = 0;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2616,12 +2617,13 @@ public final class UTF16 {
|
|||
* @see #FOLD_CASE_EXCLUDE_SPECIAL_I
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
public void setIgnoreCase(boolean ignorecase, int foldcaseoption) {
|
||||
public StringComparator setIgnoreCase(boolean ignorecase, int foldcaseoption) {
|
||||
m_ignoreCase_ = ignorecase;
|
||||
if (foldcaseoption < FOLD_CASE_DEFAULT || foldcaseoption > FOLD_CASE_EXCLUDE_SPECIAL_I) {
|
||||
throw new IllegalArgumentException("Invalid fold case option");
|
||||
}
|
||||
m_foldCase_ = foldcaseoption;
|
||||
return this;
|
||||
}
|
||||
|
||||
// public getters ----------------------------------------------------
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -132,7 +132,7 @@ public interface UnicodeMatcher {
|
|||
* @param toUnionTo the set into which to union the source characters
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public abstract void addMatchSetTo(UnicodeSet toUnionTo);
|
||||
public abstract UnicodeMatcher addMatchSetTo(UnicodeSet toUnionTo);
|
||||
}
|
||||
|
||||
//eof
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2002, International Business Machines Corporation
|
||||
* Copyright (c) 2009, International Business Machines Corporation
|
||||
* and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Date Name Description
|
||||
|
@ -58,7 +58,7 @@ interface UnicodeReplacer {
|
|||
* into the given set.
|
||||
* @param toUnionTo the set into which to union the output characters
|
||||
*/
|
||||
public abstract void addReplacementSetTo(UnicodeSet toUnionTo);
|
||||
public abstract UnicodeReplacer addReplacementSetTo(UnicodeSet toUnionTo);
|
||||
}
|
||||
|
||||
//eof
|
||||
|
|
|
@ -1004,10 +1004,12 @@ public class UnicodeSet extends UnicodeFilter implements Iterable<String>, Compa
|
|||
* characters that may be matched by this object into the given
|
||||
* set.
|
||||
* @param toUnionTo the set into which to union the source characters
|
||||
* @return
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public void addMatchSetTo(UnicodeSet toUnionTo) {
|
||||
public UnicodeSet addMatchSetTo(UnicodeSet toUnionTo) {
|
||||
toUnionTo.addAll(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -186,18 +186,20 @@ public class UnicodeSetIterator {
|
|||
* resets it to the start of that set. The iterator is valid only
|
||||
* so long as <tt>set</tt> is valid.
|
||||
* @param uset the set to iterate over.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void reset(UnicodeSet uset) {
|
||||
public UnicodeSetIterator reset(UnicodeSet uset) {
|
||||
set = uset;
|
||||
reset();
|
||||
return reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets this iterator to the start of the set.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void reset() {
|
||||
public UnicodeSetIterator reset() {
|
||||
endRange = set.getRangeCount() - 1;
|
||||
range = 0;
|
||||
endElement = -1;
|
||||
|
@ -212,6 +214,7 @@ public class UnicodeSetIterator {
|
|||
stringIterator = null;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -545,10 +545,11 @@ public abstract class BasicTimeZone extends TimeZone {
|
|||
|
||||
/**
|
||||
* Get time zone offsets from local wall time.
|
||||
* @return
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public void getOffsetFromLocal(long date,
|
||||
public BasicTimeZone getOffsetFromLocal(long date,
|
||||
int nonExistingTimeOpt, int duplicatedTimeOpt, int[] offsets) {
|
||||
throw new IllegalStateException("Not implemented");
|
||||
}
|
||||
|
|
|
@ -2045,9 +2045,10 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
/**
|
||||
* Sets this Calendar's current time from the given long value.
|
||||
* @param millis the new time in UTC milliseconds from the epoch.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setTimeInMillis( long millis ) {
|
||||
public Calendar setTimeInMillis( long millis ) {
|
||||
if (millis > MAX_MILLIS) {
|
||||
millis = MAX_MILLIS;
|
||||
} else if (millis < MIN_MILLIS) {
|
||||
|
@ -2056,6 +2057,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
time = millis;
|
||||
areFieldsSet = areAllFieldsSet = false;
|
||||
isTimeSet = areFieldsVirtuallySet = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2654,6 +2656,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
* <p>
|
||||
* @param field the calendar field to roll.
|
||||
* @param amount the amount by which the field should be rolled.
|
||||
* @return
|
||||
*
|
||||
* @exception IllegalArgumentException if the field is invalid or refers
|
||||
* to a field that cannot be handled by this method.
|
||||
|
@ -2661,10 +2664,10 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
* @see #add
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void roll(int field, int amount) {
|
||||
public Calendar roll(int field, int amount) {
|
||||
|
||||
if (amount == 0) {
|
||||
return; // Nothing to do
|
||||
return this; // Nothing to do
|
||||
}
|
||||
|
||||
complete();
|
||||
|
@ -2693,7 +2696,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
value += min;
|
||||
|
||||
set(field, value);
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
|
||||
case HOUR:
|
||||
|
@ -2715,7 +2718,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
newHour += max + 1;
|
||||
}
|
||||
setTimeInMillis(start + ONE_HOUR * (newHour - oldHour));
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
|
||||
case MONTH:
|
||||
|
@ -2736,7 +2739,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
// into the next month; e.g., we don't want jan31 + 1 mo -> feb31 ->
|
||||
// mar3.
|
||||
pinField(DAY_OF_MONTH);
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
|
||||
case YEAR:
|
||||
|
@ -2746,7 +2749,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
set(field, internalGet(field) + amount);
|
||||
pinField(MONTH);
|
||||
pinField(DAY_OF_MONTH);
|
||||
return;
|
||||
return this;
|
||||
|
||||
case WEEK_OF_MONTH:
|
||||
{
|
||||
|
@ -2827,7 +2830,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
// the appropriate fields here so that DAY_OF_MONTH is attended
|
||||
// to.
|
||||
set(DAY_OF_MONTH, day_of_month);
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
case WEEK_OF_YEAR:
|
||||
{
|
||||
|
@ -2884,7 +2887,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
// have to be updated as well.
|
||||
set(DAY_OF_YEAR, day_of_year);
|
||||
clear(MONTH);
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
case DAY_OF_YEAR:
|
||||
{
|
||||
|
@ -2896,7 +2899,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
time = (time + delta - min2) % (yearLength*ONE_DAY);
|
||||
if (time < 0) time += yearLength*ONE_DAY;
|
||||
setTimeInMillis(time + min2);
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
case DAY_OF_WEEK:
|
||||
case DOW_LOCAL:
|
||||
|
@ -2914,7 +2917,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
time = (time + delta - min2) % ONE_WEEK;
|
||||
if (time < 0) time += ONE_WEEK;
|
||||
setTimeInMillis(time + min2);
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
case DAY_OF_WEEK_IN_MONTH:
|
||||
{
|
||||
|
@ -2936,11 +2939,11 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
time = (time + delta - min2) % gap2;
|
||||
if (time < 0) time += gap2;
|
||||
setTimeInMillis(time + min2);
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
case JULIAN_DAY:
|
||||
set(field, internalGet(field) + amount);
|
||||
return;
|
||||
return this;
|
||||
default:
|
||||
// Other fields cannot be rolled by this method
|
||||
throw new IllegalArgumentException("Calendar.roll(" + fieldName(field) +
|
||||
|
@ -2991,16 +2994,17 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
* <p>
|
||||
* @param field the time field.
|
||||
* @param amount the amount to add to the field.
|
||||
* @return
|
||||
*
|
||||
* @exception IllegalArgumentException if the field is invalid or refers
|
||||
* to a field that cannot be handled by this method.
|
||||
* @see #roll(int, int)
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void add(int field, int amount) {
|
||||
public Calendar add(int field, int amount) {
|
||||
|
||||
if (amount == 0) {
|
||||
return; // Do nothing!
|
||||
return this; // Do nothing!
|
||||
}
|
||||
|
||||
// We handle most fields in the same way. The algorithm is to add
|
||||
|
@ -3030,7 +3034,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
case ERA:
|
||||
set(field, get(field) + amount);
|
||||
pinField(ERA);
|
||||
return;
|
||||
return this;
|
||||
|
||||
case YEAR:
|
||||
case EXTENDED_YEAR:
|
||||
|
@ -3038,7 +3042,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
case MONTH:
|
||||
set(field, get(field) + amount);
|
||||
pinField(DAY_OF_MONTH);
|
||||
return;
|
||||
return this;
|
||||
|
||||
case WEEK_OF_YEAR:
|
||||
case WEEK_OF_MONTH:
|
||||
|
@ -3114,6 +3118,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3753,9 +3758,10 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
/**
|
||||
* Sets the time zone with the given time zone value.
|
||||
* @param value the given time zone.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setTimeZone(TimeZone value)
|
||||
public Calendar setTimeZone(TimeZone value)
|
||||
{
|
||||
zone = value;
|
||||
/* Recompute the fields from the time using the new zone. This also
|
||||
|
@ -3768,6 +3774,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
* AFTER it up to the next call to complete().
|
||||
*/
|
||||
areFieldsSet = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3786,13 +3793,15 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
* treated as being equivalent to the 941st day after February 1, 1996.
|
||||
* With strict interpretation, such dates will cause an exception to be
|
||||
* thrown.
|
||||
* @return
|
||||
*
|
||||
* @see DateFormat#setLenient
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setLenient(boolean lenient)
|
||||
public Calendar setLenient(boolean lenient)
|
||||
{
|
||||
this.lenient = lenient;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3808,9 +3817,10 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
* Sets what the first day of the week is; e.g., Sunday in US,
|
||||
* Monday in France.
|
||||
* @param value the given first day of the week.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setFirstDayOfWeek(int value)
|
||||
public Calendar setFirstDayOfWeek(int value)
|
||||
{
|
||||
if (firstDayOfWeek != value) {
|
||||
if (value < SUNDAY || value > SATURDAY) {
|
||||
|
@ -3819,6 +3829,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
firstDayOfWeek = value;
|
||||
areFieldsSet = false;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3839,9 +3850,10 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
* must be a full week, use value 7.
|
||||
* @param value the given minimal days required in the first week
|
||||
* of the year.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setMinimalDaysInFirstWeek(int value)
|
||||
public Calendar setMinimalDaysInFirstWeek(int value)
|
||||
{
|
||||
// Values less than 1 have the same effect as 1; values greater
|
||||
// than 7 have the same effect as 7. However, we normalize values
|
||||
|
@ -3855,6 +3867,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
minimalDaysInFirstWeek = value;
|
||||
areFieldsSet = false;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -481,9 +481,10 @@ public class ChineseCalendar extends Calendar {
|
|||
|
||||
/**
|
||||
* Override Calendar to handle leap months properly.
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void add(int field, int amount) {
|
||||
public ChineseCalendar add(int field, int amount) {
|
||||
switch (field) {
|
||||
case MONTH:
|
||||
if (amount != 0) {
|
||||
|
@ -497,13 +498,15 @@ public class ChineseCalendar extends Calendar {
|
|||
super.add(field, amount);
|
||||
break;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override Calendar to handle leap months properly.
|
||||
* @return
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void roll(int field, int amount) {
|
||||
public ChineseCalendar roll(int field, int amount) {
|
||||
switch (field) {
|
||||
case MONTH:
|
||||
if (amount != 0) {
|
||||
|
@ -555,6 +558,7 @@ public class ChineseCalendar extends Calendar {
|
|||
super.roll(field, amount);
|
||||
break;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
@ -473,9 +473,10 @@ public class GregorianCalendar extends Calendar {
|
|||
* set the change date to <code>Date(Long.MIN_VALUE)</code>.
|
||||
*
|
||||
* @param date the given Gregorian cutover date.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setGregorianChange(Date date) {
|
||||
public GregorianCalendar setGregorianChange(Date date) {
|
||||
gregorianCutover = date.getTime();
|
||||
|
||||
// If the cutover has an extreme value, then create a pure
|
||||
|
@ -496,6 +497,7 @@ public class GregorianCalendar extends Calendar {
|
|||
cal.setTime(date);
|
||||
gregorianCutoverYear = cal.get(EXTENDED_YEAR);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -546,9 +548,10 @@ public class GregorianCalendar extends Calendar {
|
|||
|
||||
/**
|
||||
* Roll a field by a signed amount.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void roll(int field, int amount) {
|
||||
public GregorianCalendar roll(int field, int amount) {
|
||||
|
||||
switch (field) {
|
||||
case WEEK_OF_YEAR:
|
||||
|
@ -593,12 +596,12 @@ public class GregorianCalendar extends Calendar {
|
|||
}
|
||||
set(WEEK_OF_YEAR, woy);
|
||||
set(YEAR, isoYear); // Why not YEAR_WOY? - Alan 11/6/00
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
|
||||
default:
|
||||
super.roll(field, amount);
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2008, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -432,12 +432,13 @@ public class HebrewCalendar extends Calendar {
|
|||
* <p>
|
||||
* @param field the time field.
|
||||
* @param amount the amount to add to the field.
|
||||
* @return
|
||||
*
|
||||
* @exception IllegalArgumentException if the field is invalid or refers
|
||||
* to a field that cannot be handled by this method.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void add(int field, int amount)
|
||||
public HebrewCalendar add(int field, int amount)
|
||||
{
|
||||
switch (field) {
|
||||
case MONTH:
|
||||
|
@ -489,6 +490,7 @@ public class HebrewCalendar extends Calendar {
|
|||
super.add(field, amount);
|
||||
break;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -518,12 +520,13 @@ public class HebrewCalendar extends Calendar {
|
|||
* <p>
|
||||
* @param field the time field.
|
||||
* @param amount the amount by which the field should be rolled.
|
||||
* @return
|
||||
*
|
||||
* @exception IllegalArgumentException if the field is invalid or refers
|
||||
* to a field that cannot be handled by this method.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void roll(int field, int amount)
|
||||
public HebrewCalendar roll(int field, int amount)
|
||||
{
|
||||
switch (field) {
|
||||
case MONTH:
|
||||
|
@ -547,11 +550,12 @@ public class HebrewCalendar extends Calendar {
|
|||
}
|
||||
set(MONTH, (newMonth + 13) % 13);
|
||||
pinField(DAY_OF_MONTH);
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
default:
|
||||
super.roll(field, amount);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
|
|
@ -166,10 +166,12 @@ public final class LocaleData {
|
|||
* methods of this locale data object will return
|
||||
* an error when no data is available for that method,
|
||||
* given the locale ID supplied to the constructor.
|
||||
* @return
|
||||
* @stable ICU 3.4
|
||||
*/
|
||||
public void setNoSubstitute(boolean setting) {
|
||||
public LocaleData setNoSubstitute(boolean setting) {
|
||||
noSubstitute = setting;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,21 +35,24 @@ public class RangeDateRule implements DateRule {
|
|||
// }
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @draft ICU 2.8
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public void add(DateRule rule) {
|
||||
add(new Date(Long.MIN_VALUE), rule);
|
||||
public RangeDateRule add(DateRule rule) {
|
||||
return add(new Date(Long.MIN_VALUE), rule);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @draft ICU 2.8
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public void add(Date start, DateRule rule) {
|
||||
public RangeDateRule add(Date start, DateRule rule) {
|
||||
// TODO: Insert in the right place
|
||||
// System.out.println("Add: " + start.toString());
|
||||
ranges.addElement(new Range(start, rule));
|
||||
return this;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
* Copyright (C) 1996-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
@ -106,5 +106,5 @@ public interface RangeValueIterator
|
|||
* Resets the iterator to the beginning of the iteration.
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
public void reset();
|
||||
public RangeValueIterator reset();
|
||||
}
|
||||
|
|
|
@ -102,21 +102,25 @@ public class RuleBasedTimeZone extends BasicTimeZone {
|
|||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @return
|
||||
*
|
||||
* @stable ICU 3.8
|
||||
*/
|
||||
public void getOffset(long time, boolean local, int[] offsets) {
|
||||
public RuleBasedTimeZone getOffset(long time, boolean local, int[] offsets) {
|
||||
getOffset(time, local, LOCAL_FORMER, LOCAL_LATTER, offsets);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @return
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public void getOffsetFromLocal(long date,
|
||||
public RuleBasedTimeZone getOffsetFromLocal(long date,
|
||||
int nonExistingTimeOpt, int duplicatedTimeOpt, int[] offsets) {
|
||||
getOffset(date, true, nonExistingTimeOpt, duplicatedTimeOpt, offsets);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -146,11 +150,12 @@ public class RuleBasedTimeZone extends BasicTimeZone {
|
|||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @return
|
||||
*
|
||||
* @stable ICU 3.8
|
||||
*/
|
||||
///CLOVER:OFF
|
||||
public void setRawOffset(int offsetMillis) {
|
||||
public RuleBasedTimeZone setRawOffset(int offsetMillis) {
|
||||
// TODO: Do nothing for now..
|
||||
throw new UnsupportedOperationException("setRawOffset in RuleBasedTimeZone is not supported.");
|
||||
}
|
||||
|
|
|
@ -236,13 +236,15 @@ public class SimpleTimeZone extends BasicTimeZone {
|
|||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @return
|
||||
*
|
||||
* @stable ICU 3.8
|
||||
*/
|
||||
public void setID(String ID) {
|
||||
public SimpleTimeZone setID(String ID) {
|
||||
super.setID(ID);
|
||||
|
||||
transitionRulesInitialized = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -250,12 +252,14 @@ public class SimpleTimeZone extends BasicTimeZone {
|
|||
* Sets the base time zone offset to GMT.
|
||||
* This is the offset to add "to" UTC to get local time.
|
||||
* @param offsetMillis the raw offset of the time zone
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setRawOffset(int offsetMillis) {
|
||||
public SimpleTimeZone setRawOffset(int offsetMillis) {
|
||||
raw = offsetMillis;
|
||||
|
||||
transitionRulesInitialized = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -734,10 +738,11 @@ public class SimpleTimeZone extends BasicTimeZone {
|
|||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @return
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public void getOffsetFromLocal(long date,
|
||||
public SimpleTimeZone getOffsetFromLocal(long date,
|
||||
int nonExistingTimeOpt, int duplicatedTimeOpt, int[] offsets) {
|
||||
offsets[0] = getRawOffset();
|
||||
int fields[] = new int[6];
|
||||
|
@ -769,6 +774,7 @@ public class SimpleTimeZone extends BasicTimeZone {
|
|||
fields[0], fields[1], fields[2],
|
||||
fields[3], fields[5]) - offsets[0];
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final int
|
||||
|
|
|
@ -215,10 +215,11 @@ abstract public class TimeZone implements Serializable, Cloneable {
|
|||
* `rawOffset' to obtain the total offset between local and GMT
|
||||
* time, in offsets[1]. If DST is not in effect, the DST offset is
|
||||
* zero; otherwise it is a positive value, typically one hour.
|
||||
* @return
|
||||
*
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public void getOffset(long date, boolean local, int[] offsets) {
|
||||
public TimeZone getOffset(long date, boolean local, int[] offsets) {
|
||||
offsets[0] = getRawOffset();
|
||||
if (!local) {
|
||||
date += offsets[0]; // now in local standard millis
|
||||
|
@ -249,6 +250,7 @@ abstract public class TimeZone implements Serializable, Cloneable {
|
|||
// adjust to local standard millis
|
||||
date -= offsets[1];
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -257,7 +259,7 @@ abstract public class TimeZone implements Serializable, Cloneable {
|
|||
* @param offsetMillis the given base time zone offset to GMT.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
abstract public void setRawOffset(int offsetMillis);
|
||||
abstract public TimeZone setRawOffset(int offsetMillis);
|
||||
|
||||
/**
|
||||
* Gets unmodified offset, NOT modified in case of daylight savings.
|
||||
|
@ -280,13 +282,15 @@ abstract public class TimeZone implements Serializable, Cloneable {
|
|||
* Sets the time zone ID. This does not change any other data in
|
||||
* the time zone object.
|
||||
* @param ID the new time zone ID.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setID(String ID) {
|
||||
public TimeZone setID(String ID) {
|
||||
if (ID == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
this.ID = ID;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
* Copyright (C) 2004-2008, International Business Machines Corporation and *
|
||||
* Copyright (C) 2004-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
@ -77,11 +77,13 @@ public class UResourceBundleIterator{
|
|||
|
||||
/**
|
||||
* Resets the internal context of a resource so that iteration starts from the first element.
|
||||
* @return
|
||||
* @stable ICU 3.8
|
||||
*/
|
||||
public void reset(){
|
||||
public UResourceBundleIterator reset(){
|
||||
//reset the internal context
|
||||
index = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -82,20 +82,24 @@ public class VTimeZone extends BasicTimeZone {
|
|||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @return
|
||||
* @stable ICU 3.8
|
||||
*/
|
||||
public void getOffset(long date, boolean local, int[] offsets) {
|
||||
public VTimeZone getOffset(long date, boolean local, int[] offsets) {
|
||||
tz.getOffset(date, local, offsets);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @return
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public void getOffsetFromLocal(long date,
|
||||
public VTimeZone getOffsetFromLocal(long date,
|
||||
int nonExistingTimeOpt, int duplicatedTimeOpt, int[] offsets) {
|
||||
tz.getOffsetFromLocal(date, nonExistingTimeOpt, duplicatedTimeOpt, offsets);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,10 +120,12 @@ public class VTimeZone extends BasicTimeZone {
|
|||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @return
|
||||
* @stable ICU 3.8
|
||||
*/
|
||||
public void setRawOffset(int offsetMillis) {
|
||||
public VTimeZone setRawOffset(int offsetMillis) {
|
||||
tz.setRawOffset(offsetMillis);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2002-2003, International Business Machines Corporation
|
||||
* Copyright (c) 2002-2009, International Business Machines Corporation
|
||||
* and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Date Name Description
|
||||
|
@ -75,9 +75,11 @@ class FunctionReplacer implements UnicodeReplacer {
|
|||
* Union the set of all characters that may output by this object
|
||||
* into the given set.
|
||||
* @param toUnionTo the set into which to union the output characters
|
||||
* @return
|
||||
*/
|
||||
public void addReplacementSetTo(UnicodeSet toUnionTo) {
|
||||
public FunctionReplacer addReplacementSetTo(UnicodeSet toUnionTo) {
|
||||
toUnionTo.addAll(translit.getTargetSet());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -214,8 +214,9 @@ class StringMatcher implements UnicodeMatcher, UnicodeReplacer {
|
|||
* characters that may be matched by this object into the given
|
||||
* set.
|
||||
* @param toUnionTo the set into which to union the source characters
|
||||
* @return
|
||||
*/
|
||||
public void addMatchSetTo(UnicodeSet toUnionTo) {
|
||||
public StringMatcher addMatchSetTo(UnicodeSet toUnionTo) {
|
||||
int ch;
|
||||
for (int i=0; i<pattern.length(); i+=UTF16.getCharCount(ch)) {
|
||||
ch = UTF16.charAt(pattern, i);
|
||||
|
@ -226,6 +227,7 @@ class StringMatcher implements UnicodeMatcher, UnicodeReplacer {
|
|||
matcher.addMatchSetTo(toUnionTo);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -267,22 +269,26 @@ class StringMatcher implements UnicodeMatcher, UnicodeReplacer {
|
|||
/**
|
||||
* Remove any match data. This must be called before performing a
|
||||
* set of matches with this segment.
|
||||
* @return
|
||||
*/
|
||||
public void resetMatch() {
|
||||
public StringMatcher resetMatch() {
|
||||
matchStart = matchLimit = -1;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Union the set of all characters that may output by this object
|
||||
* into the given set.
|
||||
* @param toUnionTo the set into which to union the output characters
|
||||
* @return
|
||||
*/
|
||||
public void addReplacementSetTo(UnicodeSet toUnionTo) {
|
||||
public StringMatcher addReplacementSetTo(UnicodeSet toUnionTo) {
|
||||
// The output of this replacer varies; it is the source text between
|
||||
// matchStart and matchLimit. Since this varies depending on the
|
||||
// input text, we can't compute it here. We can either do nothing
|
||||
// or we can add ALL characters to the set. It's probably more useful
|
||||
// to do nothing.
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2002-2007, International Business Machines Corporation
|
||||
* Copyright (c) 2002-2009, International Business Machines Corporation
|
||||
* and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Date Name Description
|
||||
|
@ -315,8 +315,9 @@ class StringReplacer implements UnicodeReplacer {
|
|||
* Union the set of all characters that may output by this object
|
||||
* into the given set.
|
||||
* @param toUnionTo the set into which to union the output characters
|
||||
* @return
|
||||
*/
|
||||
public void addReplacementSetTo(UnicodeSet toUnionTo) {
|
||||
public StringReplacer addReplacementSetTo(UnicodeSet toUnionTo) {
|
||||
int ch;
|
||||
for (int i=0; i<output.length(); i+=UTF16.getCharCount(ch)) {
|
||||
ch = UTF16.charAt(output, i);
|
||||
|
@ -327,6 +328,7 @@ class StringReplacer implements UnicodeReplacer {
|
|||
r.addReplacementSetTo(toUnionTo);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -368,13 +368,15 @@ public abstract class Transliterator implements StringTransform {
|
|||
|
||||
/**
|
||||
* Copies the indices of this position from another.
|
||||
* @return
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
public void set(Position pos) {
|
||||
public Position set(Position pos) {
|
||||
contextStart = pos.contextStart;
|
||||
contextLimit = pos.contextLimit;
|
||||
start = pos.start;
|
||||
limit = pos.limit;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -807,8 +809,9 @@ public abstract class Transliterator implements StringTransform {
|
|||
* incremental processing, as described above, and undo partial
|
||||
* transliterations where necessary. If incremental is FALSE then this
|
||||
* parameter is ignored.
|
||||
* @return
|
||||
*/
|
||||
private void filteredTransliterate(Replaceable text,
|
||||
private Transliterator filteredTransliterate(Replaceable text,
|
||||
Position index,
|
||||
boolean incremental,
|
||||
boolean rollback) {
|
||||
|
@ -816,7 +819,7 @@ public abstract class Transliterator implements StringTransform {
|
|||
// non-incremental mode.
|
||||
if (filter == null && !rollback) {
|
||||
handleTransliterate(text, index, incremental);
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1109,6 +1112,7 @@ public abstract class Transliterator implements StringTransform {
|
|||
System.out.println("filteredTransliterate{"+getID()+"}: OUT=" +
|
||||
UtilityExtensions.formatInput(text, index));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1120,12 +1124,13 @@ public abstract class Transliterator implements StringTransform {
|
|||
* @param incremental if TRUE, then assume more characters may be inserted
|
||||
* at index.limit, and postpone processing to accomodate future incoming
|
||||
* characters
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void filteredTransliterate(Replaceable text,
|
||||
public Transliterator filteredTransliterate(Replaceable text,
|
||||
Position index,
|
||||
boolean incremental) {
|
||||
filteredTransliterate(text, index, incremental, false);
|
||||
return filteredTransliterate(text, index, incremental, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1307,10 +1312,12 @@ public abstract class Transliterator implements StringTransform {
|
|||
* <p>Callers must take care if a transliterator is in use by
|
||||
* multiple threads. The filter should not be changed by one
|
||||
* thread while another thread may be transliterating.
|
||||
* @return
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public void setFilter(UnicodeFilter filter) {
|
||||
public Transliterator setFilter(UnicodeFilter filter) {
|
||||
this.filter = filter;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -792,8 +792,9 @@ public class CollationAPITest extends TestFmwk {
|
|||
return key;
|
||||
}
|
||||
|
||||
public void setVariableTop(int ce)
|
||||
public Collator setVariableTop(int ce)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public int setVariableTop(String str)
|
||||
|
|
|
@ -1211,7 +1211,7 @@ public class TimeZoneTest extends TestFmwk
|
|||
*/
|
||||
private static final long serialVersionUID = 8658654217433379343L;
|
||||
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int milliseconds) {return 0;}
|
||||
public void setRawOffset(int offsetMillis) {}
|
||||
public StubTimeZone setRawOffset(int offsetMillis) {return this;}
|
||||
public int getRawOffset() {return 0;}
|
||||
public boolean useDaylightTime() {return false;}
|
||||
public boolean inDaylightTime(Date date) {return false;}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2007, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -123,24 +123,27 @@ public class ReplaceableTest extends TestFmwk {
|
|||
return chars.char32At(offset);
|
||||
}
|
||||
|
||||
public void getChars(int srcStart, int srcLimit, char dst[], int dstStart) {
|
||||
public TestReplaceable getChars(int srcStart, int srcLimit, char dst[], int dstStart) {
|
||||
chars.getChars(srcStart, srcLimit, dst, dstStart);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void replace(int start, int limit, String text) {
|
||||
if (substring(start,limit).equals(text)) return; // NO ACTION!
|
||||
public TestReplaceable replace(int start, int limit, String text) {
|
||||
if (substring(start,limit).equals(text)) return this; // NO ACTION!
|
||||
if (DEBUG) System.out.print(Utility.escape(toString() + " -> replace(" + start +
|
||||
"," + limit + "," + text) + ") -> ");
|
||||
chars.replace(start, limit, text);
|
||||
fixStyles(start, limit, text.length());
|
||||
if (DEBUG) System.out.println(Utility.escape(toString()));
|
||||
return this;
|
||||
}
|
||||
|
||||
public void replace(int start, int limit, char[] charArray,
|
||||
public TestReplaceable replace(int start, int limit, char[] charArray,
|
||||
int charsStart, int charsLen) {
|
||||
if (substring(start,limit).equals(new String(charArray, charsStart, charsLen-charsStart))) return; // NO ACTION!
|
||||
if (substring(start,limit).equals(new String(charArray, charsStart, charsLen-charsStart))) return this; // NO ACTION!
|
||||
this.chars.replace(start, limit, charArray, charsStart, charsLen);
|
||||
fixStyles(start, limit, charsLen);
|
||||
return this;
|
||||
}
|
||||
|
||||
void fixStyles(int start, int limit, int newLen) {
|
||||
|
@ -167,9 +170,10 @@ public class ReplaceableTest extends TestFmwk {
|
|||
styles.replace(start, limit, s.toString());
|
||||
}
|
||||
|
||||
public void copy(int start, int limit, int dest) {
|
||||
public TestReplaceable copy(int start, int limit, int dest) {
|
||||
chars.copy(start, limit, dest);
|
||||
styles.copy(start, limit, dest);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasMetaData() {
|
||||
|
|
|
@ -81,21 +81,22 @@ public class RoundTripTest extends TestFmwk {
|
|||
abbreviated = false;
|
||||
}
|
||||
|
||||
public void reset(UnicodeSet newSet) {
|
||||
reset(newSet, false);
|
||||
public AbbreviatedUnicodeSetIterator reset(UnicodeSet newSet) {
|
||||
return reset(newSet, false);
|
||||
}
|
||||
|
||||
public void reset(UnicodeSet newSet, boolean abb) {
|
||||
reset(newSet, abb, 100);
|
||||
public AbbreviatedUnicodeSetIterator reset(UnicodeSet newSet, boolean abb) {
|
||||
return reset(newSet, abb, 100);
|
||||
}
|
||||
|
||||
public void reset(UnicodeSet newSet, boolean abb, int density) {
|
||||
public AbbreviatedUnicodeSetIterator reset(UnicodeSet newSet, boolean abb, int density) {
|
||||
super.reset(newSet);
|
||||
abbreviated = abb;
|
||||
perRange = newSet.getRangeCount();
|
||||
if (perRange != 0) {
|
||||
perRange = density / perRange;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void loadRange(int myRange) {
|
||||
|
|
|
@ -475,7 +475,7 @@ public class TransliteratorTest extends TestFmwk {
|
|||
public boolean matchesIndexValue(int v) {
|
||||
return false;
|
||||
}
|
||||
public void addMatchSetTo(UnicodeSet toUnionTo) {}
|
||||
public UnicodeFilter addMatchSetTo(UnicodeSet toUnionTo) {return this;}
|
||||
});
|
||||
String s = "abcde";
|
||||
String out = hex.transliterate(s);
|
||||
|
|
Loading…
Add table
Reference in a new issue