102 * with <code>RuleBasedCollator</code> instances. 103 * 104 * @see Collator 105 * @see RuleBasedCollator 106 * @author Helena Shih, Laura Werner, Richard Gillam 107 */ 108 public final class CollationElementIterator 109 { 110 /** 111 * Null order which indicates the end of string is reached by the 112 * cursor. 113 */ 114 public final static int NULLORDER = 0xffffffff; 115 116 /** 117 * CollationElementIterator constructor. This takes the source string and 118 * the collation object. The cursor will walk thru the source string based 119 * on the predefined collation rules. If the source string is empty, 120 * NULLORDER will be returned on the calls to next(). 121 * @param sourceText the source string. 122 * @param order the collation object. 123 */ 124 CollationElementIterator(String sourceText, RuleBasedCollator owner) { 125 this.owner = owner; 126 ordering = owner.getTables(); 127 if ( sourceText.length() != 0 ) { 128 NormalizerBase.Mode mode = 129 CollatorUtilities.toNormalizerMode(owner.getDecomposition()); 130 text = new NormalizerBase(sourceText, mode); 131 } 132 } 133 134 /** 135 * CollationElementIterator constructor. This takes the source string and 136 * the collation object. The cursor will walk thru the source string based 137 * on the predefined collation rules. If the source string is empty, 138 * NULLORDER will be returned on the calls to next(). 139 * @param sourceText the source string. 140 * @param order the collation object. 141 */ 142 CollationElementIterator(CharacterIterator sourceText, RuleBasedCollator owner) { 143 this.owner = owner; 144 ordering = owner.getTables(); 145 NormalizerBase.Mode mode = 146 CollatorUtilities.toNormalizerMode(owner.getDecomposition()); 147 text = new NormalizerBase(sourceText, mode); 148 } 149 150 /** 151 * Resets the cursor to the beginning of the string. The next call 152 * to next() will return the first collation element in the string. 153 */ 154 public void reset() 155 { 156 if (text != null) { 157 text.reset(); 158 NormalizerBase.Mode mode = 159 CollatorUtilities.toNormalizerMode(owner.getDecomposition()); 160 text.setMode(mode); | 102 * with <code>RuleBasedCollator</code> instances. 103 * 104 * @see Collator 105 * @see RuleBasedCollator 106 * @author Helena Shih, Laura Werner, Richard Gillam 107 */ 108 public final class CollationElementIterator 109 { 110 /** 111 * Null order which indicates the end of string is reached by the 112 * cursor. 113 */ 114 public final static int NULLORDER = 0xffffffff; 115 116 /** 117 * CollationElementIterator constructor. This takes the source string and 118 * the collation object. The cursor will walk thru the source string based 119 * on the predefined collation rules. If the source string is empty, 120 * NULLORDER will be returned on the calls to next(). 121 * @param sourceText the source string. 122 * @param owner the collation object. 123 */ 124 CollationElementIterator(String sourceText, RuleBasedCollator owner) { 125 this.owner = owner; 126 ordering = owner.getTables(); 127 if ( sourceText.length() != 0 ) { 128 NormalizerBase.Mode mode = 129 CollatorUtilities.toNormalizerMode(owner.getDecomposition()); 130 text = new NormalizerBase(sourceText, mode); 131 } 132 } 133 134 /** 135 * CollationElementIterator constructor. This takes the source string and 136 * the collation object. The cursor will walk thru the source string based 137 * on the predefined collation rules. If the source string is empty, 138 * NULLORDER will be returned on the calls to next(). 139 * @param sourceText the source string. 140 * @param owner the collation object. 141 */ 142 CollationElementIterator(CharacterIterator sourceText, RuleBasedCollator owner) { 143 this.owner = owner; 144 ordering = owner.getTables(); 145 NormalizerBase.Mode mode = 146 CollatorUtilities.toNormalizerMode(owner.getDecomposition()); 147 text = new NormalizerBase(sourceText, mode); 148 } 149 150 /** 151 * Resets the cursor to the beginning of the string. The next call 152 * to next() will return the first collation element in the string. 153 */ 154 public void reset() 155 { 156 if (text != null) { 157 text.reset(); 158 NormalizerBase.Mode mode = 159 CollatorUtilities.toNormalizerMode(owner.getDecomposition()); 160 text.setMode(mode); |