Class UCharacterNameIterator
- All Implemented Interfaces:
ValueIterator
Class enabling iteration of the codepoints and their names.
Result of each iteration contains a valid codepoint that has valid name.
See UCharacter.getNameIterator() for an example of use.
- Since:
- release 2.1, March 5 2002
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.ibm.icu.util.ValueIterator
ValueIterator.Element
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static char[]
private static char[]
Group useprivate int
Algorithm indexprivate int
Name choiceprivate int
Current codepointprivate int
Group indexprivate int
End + 1 iteration rangeprivate UCharacterName
Name dataprivate int
Start iteration range -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
UCharacterNameIterator
(UCharacterName name, int choice) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
iterateExtended
(ValueIterator.Element result, int limit) Iterate extended names.private boolean
iterateGroup
(ValueIterator.Element result, int limit) Group name iteration, iterate all the names in the current 32-group and returns the first codepoint that has a valid name.private boolean
iterateSingleGroup
(ValueIterator.Element result, int limit) Group name iteration, iterate all the names in the current 32-group and returns the first codepoint that has a valid name.boolean
next
(ValueIterator.Element element) Gets the next result for this iteration and returns true if we are not at the end of the iteration, false otherwise.void
reset()
Resets the iterator to start iterating from the integer index UCharacter.MIN_VALUE or X if a setRange(X, Y) has been called previously.void
setRange
(int start, int limit) Restricts the range of integers to iterate and resets the iteration to begin at the index argument start.
-
Field Details
-
m_name_
Name data -
m_choice_
private int m_choice_Name choice -
m_start_
private int m_start_Start iteration range -
m_limit_
private int m_limit_End + 1 iteration range -
m_current_
private int m_current_Current codepoint -
m_groupIndex_
private int m_groupIndex_Group index -
m_algorithmIndex_
private int m_algorithmIndex_Algorithm index -
GROUP_OFFSETS_
private static char[] GROUP_OFFSETS_Group use -
GROUP_LENGTHS_
private static char[] GROUP_LENGTHS_
-
-
Constructor Details
-
UCharacterNameIterator
Constructor- Parameters:
name
- name datachoice
- name choice from the class com.ibm.icu.lang.UCharacterNameChoice
-
-
Method Details
-
next
Gets the next result for this iteration and returns true if we are not at the end of the iteration, false otherwise.
If the return boolean is a false, the contents of elements will not be updated.
- Specified by:
next
in interfaceValueIterator
- Parameters:
element
- for storing the result codepoint and name- Returns:
- true if we are not at the end of the iteration, false otherwise.
- See Also:
-
reset
public void reset()Resets the iterator to start iterating from the integer index UCharacter.MIN_VALUE or X if a setRange(X, Y) has been called previously.
- Specified by:
reset
in interfaceValueIterator
-
setRange
public void setRange(int start, int limit) Restricts the range of integers to iterate and resets the iteration to begin at the index argument start.
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.
If this range is set outside the range of UCharacter.MIN_VALUE and UCharacter.MAX_VALUE, next(element) will always return false.
- Specified by:
setRange
in interfaceValueIterator
- Parameters:
start
- first integer in range to iteratelimit
- 1 integer after the last integer in range- Throws:
IllegalArgumentException
- thrown when attempting to set an illegal range. E.g limit invalid input: '<'= start
-
iterateSingleGroup
Group name iteration, iterate all the names in the current 32-group and returns the first codepoint that has a valid name.- Parameters:
result
- stores the result codepoint and namelimit
- last codepoint + 1 in range to search- Returns:
- false if a codepoint with a name is found in group and we can bail from further iteration, true to continue on with the iteration
-
iterateGroup
Group name iteration, iterate all the names in the current 32-group and returns the first codepoint that has a valid name.- Parameters:
result
- stores the result codepoint and namelimit
- last codepoint + 1 in range to search- Returns:
- false if a codepoint with a name is found in group and we can bail from further iteration, true to continue on with the iteration
-
iterateExtended
Iterate extended names.- Parameters:
result
- stores the result codepoint and namelimit
- last codepoint + 1 in range to search- Returns:
- false if a codepoint with a name is found and we can bail from further iteration, true to continue on with the iteration (this will always be false for valid codepoints)
-