/** * Returns the next element from an iterator. * @param it iterator * @return next element, or {@code -1} */ private static int next(final CollationElementIterator it) { do { final int c = it.next(); if(c != 0) return c; } while(true); } }
/** * Returns the next element from an iterator. * @param it iterator * @return next element, or {@code -1} */ private static int next(final CollationElementIterator it) { do { final int c = it.next(); if(c != 0) return c; } while(true); } }
/** * Determine whether one string starts with another, under the terms of a given * collating sequence. * * @param s0 iterator over the collation elements of the containing string * @param s1 iterator over the collation elements of the contained string * @return true if the first string starts with the second */ private boolean collationStartsWith(CollationElementIterator s0, CollationElementIterator s1) { while (true) { int e0, e1; do { e1 = s1.next(); } while (e1 == 0); if (e1 == -1) { return true; } do { e0 = s0.next(); } while (e0 == 0); if (e0 != e1) { return false; } } }
/** * Determine whether one string starts with another, under the terms of a given * collating sequence. * @param s0 iterator over the collation elements of the containing string * @param s1 iterator over the collation elements of the contained string * @return true if the first string starts with the second */ private boolean collationStartsWith(CollationElementIterator s0, CollationElementIterator s1) { while (true) { int e0, e1; do { e1 = s1.next(); } while (e1 == 0); if (e1 == -1) { return true; } do { e0 = s0.next(); } while (e0 == 0); if (e0 != e1) { return false; } } }
/** * Determine whether one string starts with another, under the terms of a given * collating sequence. * @param s0 iterator over the collation elements of the containing string * @param s1 iterator over the collation elements of the contained string * @return true if the first string starts with the second */ private boolean collationStartsWith(CollationElementIterator s0, CollationElementIterator s1) { while (true) { int e0, e1; do { e1 = s1.next(); } while (e1 == 0); if (e1 == -1) { return true; } do { e0 = s0.next(); } while (e0 == 0); if (e0 != e1) { return false; } } }
/** * Determine whether one string starts with another, under the terms of a given * collating sequence. * * @param s0 iterator over the collation elements of the containing string * @param s1 iterator over the collation elements of the contained string * @return true if the first string starts with the second */ private boolean collationStartsWith(CollationElementIterator s0, CollationElementIterator s1) { while (true) { int e0, e1; do { e1 = s1.next(); } while (e1 == 0); if (e1 == -1) { return true; } do { e0 = s0.next(); } while (e0 == 0); if (e0 != e1) { return false; } } }
/** * Determine whether one string starts with another, under the terms of a given * collating sequence. * * @param s0 iterator over the collation elements of the containing string * @param s1 iterator over the collation elements of the contained string * @return true if the first string starts with the second */ private boolean collationStartsWith(CollationElementIterator s0, CollationElementIterator s1) { makeStrengthObject(); while (true) { int e0, e1; e1 = s1.next(); if (e1 == CollationElementIterator.NULLORDER) { return true; } e0 = s0.next(); if (e0 == CollationElementIterator.NULLORDER) { return false; } if (strengthLevel.compare(e0, e1) != 0) { return false; } } }
/** * Determine whether one string starts with another, under the terms of a given * collating sequence. * * @param s0 iterator over the collation elements of the containing string * @param s1 iterator over the collation elements of the contained string * @return true if the first string starts with the second */ private boolean collationStartsWith(CollationElementIterator s0, CollationElementIterator s1) { makeStrengthObject(); while (true) { int e0, e1; e1 = s1.next(); if (e1 == CollationElementIterator.NULLORDER) { return true; } e0 = s0.next(); if (e0 == CollationElementIterator.NULLORDER) { return false; } if (strengthLevel.compare(e0, e1) != 0) { return false; } } }
/** * Test program to output the sequence of collation element iterators for a given input string * * @param args command line arguments (collationURI, test-string) */ public static void main(String[] args) throws Exception { String rules = " ='-'='*'< a < b < c < d < e < f < g < h < i < j < k < l < m < n < o < p < q < r < s < t < u < v < w < x < y < z"; RuleBasedCollator collator = new RuleBasedCollator(rules); for (int i = 0; i < args.length; i++) { System.err.println(args[i]); FastStringBuffer sb = new FastStringBuffer(FastStringBuffer.C256); CollationElementIterator iter = collator.getCollationElementIterator(args[i]); while (true) { int e = iter.next(); if (e == -1) { break; } sb.append(e + " "); } System.err.println(sb.toString()); } }
/** * Test program to output the sequence of collation element iterators for a given input string * * @param args command line arguments (collationURI, test-string) */ public static void main(String[] args) throws Exception { String rules = " ='-'='*'< a < b < c < d < e < f < g < h < i < j < k < l < m < n < o < p < q < r < s < t < u < v < w < x < y < z"; RuleBasedCollator collator = new RuleBasedCollator(rules); for (int i = 0; i < args.length; i++) { System.err.println(args[i]); FastStringBuffer sb = new FastStringBuffer(FastStringBuffer.C256); CollationElementIterator iter = collator.getCollationElementIterator(args[i]); while (true) { int e = iter.next(); if (e == -1) { break; } sb.append(e + " "); } System.err.println(sb.toString()); } }
makeStrengthObject(); int e0, e1; e1 = s1.next(); if (e1 == CollationElementIterator.NULLORDER) { return true; e0 = s0.next(); if (e0 == CollationElementIterator.NULLORDER) { if (collationStartsWith(s0, s1)) { if (matchAtEnd) { e0 = s0.next(); if (e0 == CollationElementIterator.NULLORDER) { s0.next(); e1 = s1.next();
/** * Test program to output the sequence of collation element iterators for a given input string * @param args command line arguments (collationURI, test-string) */ public static void main(String[] args) { Configuration config = new Configuration(); StringCollator collator = StandardCollationURIResolver.getInstance().resolve(args[0], args[0], config); FastStringBuffer sb = new FastStringBuffer(100); if (collator instanceof RuleBasedCollator) { CollationElementIterator iter = ((RuleBasedCollator)collator).getCollationElementIterator(args[1]); while (true) { int e = iter.next(); if (e==-1) { break; } sb.append(e+" "); } System.err.println(sb.toString()); } }
/** * Test program to output the sequence of collation element iterators for a given input string * @param args command line arguments (collationURI, test-string) */ public static void main(String[] args) { Configuration config = new Configuration(); StringCollator collator = StandardCollationURIResolver.getInstance().resolve(args[0], args[0], config); FastStringBuffer sb = new FastStringBuffer(100); if (collator instanceof RuleBasedCollator) { CollationElementIterator iter = ((RuleBasedCollator)collator).getCollationElementIterator(args[1]); while (true) { int e = iter.next(); if (e==-1) { break; } sb.append(e+" "); } System.err.println(sb.toString()); } }
while ((nextInt = cei.next()) != CollationElementIterator.NULLORDER)
while ((nextInt = cei.next()) != CollationElementIterator.NULLORDER)