2 ******************************************************************************
\r
3 * Copyright (C) 1996-2008, International Business Machines Corporation and *
\r
4 * others. All Rights Reserved. *
\r
5 ******************************************************************************
\r
8 package com.ibm.icu.lang;
\r
10 import com.ibm.icu.impl.TrieIterator;
\r
11 import com.ibm.icu.impl.UCharacterProperty;
\r
14 * Class enabling iteration of the codepoints according to their types.
\r
15 * Result of each iteration contains the interval of codepoints that have
\r
17 * Example of use:<br>
\r
19 * RangeValueIterator iterator = UCharacter.getTypeIterator();
\r
20 * RangeValueIterator.Element element = new RangeValueIterator.Element();
\r
21 * while (iterator.next(element)) {
\r
22 * System.out.println("Codepoint \\u" +
\r
23 * Integer.toHexString(element.start) +
\r
24 * " to codepoint \\u" +
\r
25 * Integer.toHexString(element.limit - 1) +
\r
26 * " has the character type " +
\r
31 * @see com.ibm.icu.util.TrieIterator
\r
32 * @since release 2.1, Jan 24 2002
\r
34 class UCharacterTypeIterator extends TrieIterator
\r
36 // protected constructor ---------------------------------------------
\r
39 * TrieEnumeration constructor
\r
40 * @param property the unicode character properties to be used
\r
42 protected UCharacterTypeIterator(UCharacterProperty property)
\r
44 super(property.m_trie_);
\r
47 // protected methods ----------------------------------------------
\r
50 * Called by nextElement() to extracts a 32 bit value from a trie value
\r
51 * used for comparison.
\r
52 * This method is to be overwritten if special manipulation is to be done
\r
53 * to retrieve a relevant comparison.
\r
54 * The default function is to return the value as it is.
\r
55 * @param value a value from the trie
\r
56 * @return extracted value
\r
58 protected int extract(int value)
\r
60 return value & UCharacterProperty.TYPE_MASK;
\r