strIter.setOffset(startingAt); int oStr = strIter.next(); int oKey = keyIter.next(); while (oKey != CollationElementIterator.NULLORDER) { while (oStr != CollationElementIterator.NULLORDER && CollationElementIterator.primaryOrder(oStr) == 0) { oStr = strIter.next(); CollationElementIterator.primaryOrder(oKey) == 0) { oKey = keyIter.next(); if (CollationElementIterator.primaryOrder(oStr) == CollationElementIterator.primaryOrder(oKey)) { keyStart = strIter.getOffset(); oStr = strIter.next(); oKey = keyIter.next(); } else { if (keyStart != -1) { keyStart = -1; keyIter.reset(); } else { oStr = strIter.next(); return new int[] { keyStart, strIter.getOffset() - keyStart };
coleiter = new CollationElementIterator(pattern_.text_, collator_); utilIter_ = coleiter; } else { coleiter.setText(pattern_.text_); int ce; while ((ce = coleiter.next()) != CollationElementIterator.NULLORDER) { int newce = getCE(ce); if (newce != CollationElementIterator.IGNORABLE /* 0 */) { int[] temp = addToIntArray(cetable, offset, cetablesize, newce, patternlength - coleiter.getOffset() + 1); offset++; cetable = temp; result += (coleiter.getMaxExpansion(ce) - 1);
private final void initMaxExpansions() { synchronized(tailoring) { if (tailoring.maxExpansions == null) { tailoring.maxExpansions = CollationElementIterator.computeMaxExpansions(tailoring.data); } } }
public boolean allIgnorable(String s) { CollationElementIterator iter = collator.getCollationElementIterator(s); int o = iter.next(); while (o != CollationElementIterator.NULLORDER && CollationElementIterator.primaryOrder(o) == 0) { o = iter.next(); } return o == CollationElementIterator.NULLORDER; }
int oStr = strIter.next(); int oPrefix = prefixIter.next(); while (CollationElementIterator.primaryOrder(oStr) == 0 && oStr != CollationElementIterator.NULLORDER) { oStr = strIter.next(); while (CollationElementIterator.primaryOrder(oPrefix) == 0 && oPrefix != CollationElementIterator.NULLORDER) { oPrefix = prefixIter.next(); if (CollationElementIterator.primaryOrder(oStr) != CollationElementIterator.primaryOrder(oPrefix)) { return 0; oStr = strIter.next(); oPrefix = prefixIter.next(); int result = strIter.getOffset(); if (oStr != CollationElementIterator.NULLORDER) { --result;
coleiter = new CollationElementIterator(pattern_.text_, collator_); utilIter_ = coleiter; } else { coleiter.setText(pattern_.text_); long[] temp = addToLongArray(pcetable, offset, pcetablesize, pce, patternlength - coleiter.getOffset() + 1); offset++; pcetable = temp;
int firstHalf = getFirstHalf(p, lower32); int secondHalf = getSecondHalf(p, lower32); if (secondHalf != 0) { otherHalf_ = secondHalf | 0xc0; // continuation CE
/** * Uses a Locale dependent Collator to generate a sort string * * @param str The string to parse * @return String the sort ordering text */ @Override public String filter(String str) { RuleBasedCollator collator = getCollator(); // Have we got a collator? if (collator != null) { int element; StringBuffer buf = new StringBuffer(); // Iterate through the elements of the collator CollationElementIterator iter = collator.getCollationElementIterator(str); while ((element = iter.next()) != CollationElementIterator.NULLORDER) { // Generate a hexadecimal string representation of the Collation element // This can then be compared in a text sort ;-) String test = Integer.toString(element, 16); buf.append(test); } return buf.toString(); } return str; }
/** * Return a CollationElementIterator for the given UCharacterIterator. The source iterator's integrity will be * preserved since a new copy will be created for use. * * @see CollationElementIterator * @stable ICU 2.8 */ public CollationElementIterator getCollationElementIterator(UCharacterIterator source) { initMaxExpansions(); return new CollationElementIterator(source, this); }
/** * {@inheritDoc} * @stable ICU 2.8 */ @Override public int getIndex() { int result = textIter_.getOffset(); if (isOutOfBounds(search_.beginIndex(), search_.endIndex(), result)) { return DONE; } return result; }
/** * Returns the maximum length of any expansion sequence that ends with * the specified collation element. If there is no expansion with this * collation element as the last element, returns 1. * * @param ce a collation element returned by previous() or next(). * @return the maximum length of any expansion sequence ending * with the specified collation element. * @stable ICU 2.8 */ public int getMaxExpansion(int ce) { return getMaxExpansion(rbc_.tailoring.maxExpansions, ce); }
public void init(CollationElementIterator iter) { cei_ = iter; init(iter.getRuleBasedCollator()); }
/** * Tests that argument object is equals to this CollationElementIterator. * Iterators are equal if the objects uses the same RuleBasedCollator, * the same source text and have the same current position in iteration. * @param that object to test if it is equals to this * CollationElementIterator * @stable ICU 2.8 */ @Override public boolean equals(Object that) { if (that == this) { return true; } if (that instanceof CollationElementIterator) { CollationElementIterator thatceiter = (CollationElementIterator) that; return rbc_.equals(thatceiter.rbc_) && otherHalf_ == thatceiter.otherHalf_ && normalizeDir() == thatceiter.normalizeDir() && string_.equals(thatceiter.string_) && iter_.equals(thatceiter.iter_); } return false; }
int firstHalf = getFirstHalf(p, lower32); int secondHalf = getSecondHalf(p, lower32); if (secondHalf != 0) { if (offsets_.isEmpty()) {
/** * Return a CollationElementIterator for the given String. * * @see CollationElementIterator * @stable ICU 2.8 */ public CollationElementIterator getCollationElementIterator(String source) { initMaxExpansions(); return new CollationElementIterator(source, this); }
private boolean handleNextCommonImpl() { int textOffset = textIter_.getOffset(); Match match = new Match(); if (search(textOffset, match)) { search_.matchedIndex_ = match.start_; search_.setMatchedLength(match.limit_ - match.start_); return true; } else { setMatchNotFound(); return false; } }
/** * Return a CollationElementIterator for the given CharacterIterator. The source iterator's integrity will be * preserved since a new copy will be created for use. * * @see CollationElementIterator * @stable ICU 2.8 */ public CollationElementIterator getCollationElementIterator(CharacterIterator source) { initMaxExpansions(); CharacterIterator newsource = (CharacterIterator) source.clone(); return new CollationElementIterator(newsource, this); }