ICU-1707
Update documentation X-SVN-Rev: 8394
This commit is contained in:
parent
fecbc19604
commit
c5e0da94cc
@ -5,8 +5,8 @@
|
||||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/lang/UCharacterTest.java,v $
|
||||
* $Date: 2002/04/03 04:32:00 $
|
||||
* $Revision: 1.36 $
|
||||
* $Date: 2002/04/05 01:38:11 $
|
||||
* $Revision: 1.37 $
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -686,10 +686,39 @@ public final class UCharacterTest extends TestFmwk
|
||||
*/
|
||||
public void TestNameIteration()
|
||||
{
|
||||
ValueIterator iterator = UCharacter.getNameIterator();
|
||||
ValueIterator iterator = UCharacter.getExtendedNameIterator();
|
||||
ValueIterator.Element element = new ValueIterator.Element();
|
||||
ValueIterator.Element old = new ValueIterator.Element();
|
||||
// testing subrange
|
||||
iterator.setRange(-10, -5);
|
||||
if (iterator.next(element)) {
|
||||
errln("Fail, expected iterator to return false when range is set outside the meaningful range");
|
||||
}
|
||||
iterator.setRange(0x110000, 0x111111);
|
||||
if (iterator.next(element)) {
|
||||
errln("Fail, expected iterator to return false when range is set outside the meaningful range");
|
||||
}
|
||||
try {
|
||||
iterator.setRange(50, 10);
|
||||
errln("Fail, expected exception when encountered invalid range");
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
iterator.setRange(-10, 10);
|
||||
if (!iterator.next(element) || element.integer != 0) {
|
||||
errln("Fail, expected iterator to return 0 when range start limit is set outside the meaningful range");
|
||||
}
|
||||
|
||||
iterator.setRange(0x10FFFE, 0x200000);
|
||||
int last = 0;
|
||||
while (iterator.next(element)) {
|
||||
last = element.integer;
|
||||
}
|
||||
if (last != 0x10FFFF) {
|
||||
errln("Fail, expected iterator to return 0x10FFFF when range end limit is set outside the meaningful range");
|
||||
}
|
||||
|
||||
iterator = UCharacter.getNameIterator();
|
||||
iterator.setRange(0xF, 0x45);
|
||||
while (iterator.next(element)) {
|
||||
if (element.integer <= old.integer) {
|
||||
|
@ -5,8 +5,8 @@
|
||||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/lang/UCharacter.java,v $
|
||||
* $Date: 2002/04/04 22:38:13 $
|
||||
* $Revision: 1.38 $
|
||||
* $Date: 2002/04/05 01:38:15 $
|
||||
* $Revision: 1.39 $
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -1415,6 +1415,7 @@ public final class UCharacter
|
||||
* " has the name " + (String)element.value);
|
||||
* }
|
||||
* </pre>
|
||||
* <p>The maximal range which the name iterator iterates is from
|
||||
* @return an iterator
|
||||
* @draft 2.1
|
||||
*/
|
||||
@ -1439,6 +1440,7 @@ public final class UCharacter
|
||||
* " has the name " + (String)element.value);
|
||||
* }
|
||||
* </pre>
|
||||
* <p>The maximal range which the name iterator iterates is from
|
||||
* @return an iterator
|
||||
* @draft 2.1
|
||||
*/
|
||||
|
@ -5,8 +5,8 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/lang/UCharacterNameIterator.java,v $
|
||||
* $Date: 2002/03/13 01:09:33 $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2002/04/05 01:38:15 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
@ -16,10 +16,10 @@ package com.ibm.icu.lang;
|
||||
import com.ibm.icu.util.ValueIterator;
|
||||
|
||||
/**
|
||||
* Class enabling iteration of the codepoints and their names.
|
||||
* Result of each iteration contains a valid codepoints that have the result
|
||||
* name.
|
||||
* See UCharacter.getNameIterator() for an example of use.
|
||||
* <p>Class enabling iteration of the codepoints and their names.</p>
|
||||
* <p>Result of each iteration contains a valid codepoint that has valid
|
||||
* name.</p>
|
||||
* <p>See UCharacter.getNameIterator() for an example of use.</p>
|
||||
* @author synwee
|
||||
* @since release 2.1, March 5 2002
|
||||
*/
|
||||
@ -32,7 +32,7 @@ class UCharacterNameIterator implements ValueIterator
|
||||
* true if we are not at the end of the iteration, false otherwise.</p>
|
||||
* <p>If the return boolean is a false, the contents of elements will not
|
||||
* be updated.</p>
|
||||
* @param element for storing the result range and value
|
||||
* @param element for storing the result codepoint and name
|
||||
* @return true if we are not at the end of the iteration, false otherwise.
|
||||
* @see Element
|
||||
* @draft 2.1
|
||||
@ -108,7 +108,9 @@ class UCharacterNameIterator implements ValueIterator
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the iterator to the beginning of the iteration.
|
||||
* <p>Resets the iterator to start iterating from the integer index
|
||||
* UCharacter.MIN_VALUE or X if a setRange(X, Y) has been called previously.
|
||||
* </p>
|
||||
* @draft 2.1
|
||||
*/
|
||||
public void reset()
|
||||
@ -119,22 +121,41 @@ class UCharacterNameIterator implements ValueIterator
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the range for iteration
|
||||
* @param start first codepoint to iterate
|
||||
* @param limit one codepoint after the last codepoint to iterate
|
||||
* @exception IllegalArgumentException thrown when start or limit exceed
|
||||
* the Unicode codepoint bounds or when start > limit.
|
||||
* <p>Restricts the range of integers to iterate and resets the iteration
|
||||
* to begin at the index argument start.</p>
|
||||
* <p>If setRange(start, end) is not performed before next(element) is
|
||||
* called, the iteration will start from the integer index
|
||||
* UCharacter.MIN_VALUE and end at UCharacter.MAX_VALUE.</p>
|
||||
* <p>
|
||||
* If this range is set outside the range of UCharacter.MIN_VALUE and
|
||||
* UCharacter.MAX_VALUE, next(element) will always return false.
|
||||
* </p>
|
||||
* @param start first integer in range to iterate
|
||||
* @param limit 1 integer after the last integer in range
|
||||
* @exception IllegalArgumentException thrown when attempting to set an
|
||||
* illegal range. E.g limit <= start
|
||||
* @draft 2.1
|
||||
*/
|
||||
public void setRange(int start, int limit)
|
||||
{
|
||||
if (start > limit || start < UCharacter.MIN_VALUE ||
|
||||
limit > UCharacter.MAX_VALUE + 1) {
|
||||
if (start >= limit) {
|
||||
throw new IllegalArgumentException(
|
||||
"start or limit has to be valid Unicode codepoints and start <= limit");
|
||||
"start or limit has to be valid Unicode codepoints and start < limit");
|
||||
}
|
||||
m_start_ = start;
|
||||
m_limit_ = limit;
|
||||
m_current_ = start;
|
||||
if (start < UCharacter.MIN_VALUE) {
|
||||
m_start_ = UCharacter.MIN_VALUE;
|
||||
}
|
||||
else {
|
||||
m_start_ = start;
|
||||
}
|
||||
|
||||
if (limit > UCharacter.MAX_VALUE + 1) {
|
||||
m_limit_ = UCharacter.MAX_VALUE + 1;
|
||||
}
|
||||
else {
|
||||
m_limit_ = limit;
|
||||
}
|
||||
m_current_ = m_start_;
|
||||
}
|
||||
|
||||
// protected constructor ---------------------------------------------
|
||||
|
@ -5,8 +5,8 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/util/ValueIterator.java,v $
|
||||
* $Date: 2002/04/05 00:12:09 $
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 2002/04/05 01:38:11 $
|
||||
* $Revision: 1.7 $
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
@ -69,7 +69,7 @@ public interface ValueIterator
|
||||
* true if we are not at the end of the iteration, false otherwise.</p>
|
||||
* <p>If the return boolean is a false, the contents of elements will not
|
||||
* be updated.</p>
|
||||
* @param element for storing the result range and value
|
||||
* @param element for storing the result index and value
|
||||
* @return true if we are not at the end of the iteration, false otherwise.
|
||||
* @see Element
|
||||
* @draft 2.1
|
||||
@ -85,17 +85,19 @@ public interface ValueIterator
|
||||
public void reset();
|
||||
|
||||
/**
|
||||
* <p>Restricts the range of integers to iterate.</p>
|
||||
* <p>If setRange() is not performed before next() is called, the
|
||||
* iteration will start from the integer.Integer.MIN_VALUE and ends at a
|
||||
* maximum integer index that is determined by the specific implementation
|
||||
* of ValueIterator.</p>
|
||||
* <p>For instance the Unicode character name iterator provided by
|
||||
* com.ibm.icu.lang.UCharacter.getNameIterator() will iterate the names
|
||||
* from UCharacter.MIN_VALUE to UCharacter.MAX_VALUE if setRange() was
|
||||
* never called.</p>
|
||||
* <p>Restricts the range of integers to iterate and resets the iteration
|
||||
* to begin at the index argument start.</p>
|
||||
* <p>If setRange(start, end) is not performed before next(element) is
|
||||
* called, the iteration will start from the integer index
|
||||
* Integer.MIN_VALUE and end at Integer.MAX_VALUE.</p>
|
||||
* <p>
|
||||
* If this range is set outside the meaningful range specified by the
|
||||
* implementation, next(element) will always return false.
|
||||
* </p>
|
||||
* @param start first integer in range to iterate
|
||||
* @param limit 1 integer after the last integer in range
|
||||
* @exception IllegalArgumentException thrown when attempting to set an
|
||||
* illegal range. E.g limit <= start
|
||||
* @draft 2.1
|
||||
*/
|
||||
public void setRange(int start, int end);
|
||||
|
Loading…
Reference in New Issue
Block a user