diff --git a/icu4j/src/com/ibm/icu/impl/TrieIterator.java b/icu4j/src/com/ibm/icu/impl/TrieIterator.java index de868d65f1..01ba8864c7 100755 --- a/icu4j/src/com/ibm/icu/impl/TrieIterator.java +++ b/icu4j/src/com/ibm/icu/impl/TrieIterator.java @@ -5,8 +5,8 @@ ****************************************************************************** * * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/impl/TrieIterator.java,v $ -* $Date: 2002/07/12 21:59:22 $ -* $Revision: 1.6 $ +* $Date: 2002/11/15 20:39:26 $ +* $Revision: 1.7 $ * ****************************************************************************** */ @@ -29,6 +29,22 @@ import com.ibm.icu.util.RangeValueIterator; * and the IntTrie, hence to accommodate both types of data, the return * result will be in terms of int (32 bit) values.
*See com.ibm.icu.text.UCharacterTypeIterator for examples of use.
+ *Notes for porting utrie_enum from icu4c to icu4j:
+ * Internally, icu4c's utrie_enum performs all iterations in its body. In Java
+ * sense, the caller will have to pass a object with a callback function
+ * UTrieEnumRange(const void *context, UChar32 start, UChar32 limit,
+ * uint32_t value) into utrie_enum. utrie_enum will then find ranges of
+ * codepoints with the same value as determined by
+ * UTrieEnumValue(const void *context, uint32_t value). for each range,
+ * utrie_enum calls the callback function to perform a task. In this way,
+ * icu4c performs the iteration within utrie_enum.
+ * To follow the JDK model, icu4j is slightly different from icu4c.
+ * Instead of requesting the caller to implement an object for a callback.
+ * The caller will have to implement a subclass of TrieIterator, fleshing out
+ * the method extract(int) (equivalent to UTrieEnumValue). Independent of icu4j,
+ * the caller will have to code his own iteration and flesh out the task
+ * (equivalent to UTrieEnumRange) to be performed in the iteration loop.
+ *
- * UCharacterTypeIterator iterator = UCharacter.getUCharacterTypeIterator(); - * while (iterator.next()) { + * RangeValueIterator iterator = UCharacter.getTypeIterator(); + * RangeValueIterator.Element element = new RangeValueIterator.Element(); + * while (iterator.next(element)) { * System.out.println("Codepoint \\u" + - * Integer.toHexString(iterator.getStart()) + + * Integer.toHexString(element.start) + * " to codepoint \\u" + - * Integer.toHexString(iterator.getLimit() - 1) + - * " has the character type " + iterator.getValue()); + * Integer.toHexString(element.limit - 1) + + * " has the character type " + + * element.value); * } ** @author synwee