Package java.text

Examples of java.text.RuleBasedCollator$CollationSorter


      }
    }

    intArray = new int[getLength()];

    RuleBasedCollator rbc = getLocaleFinder().getCollator();
    CollationElementIterator cei = rbc.getCollationElementIterator(getString());
    int nextInt;
    while ((nextInt = cei.next()) != CollationElementIterator.NULLORDER)
    {
      /* Believe it or not, a String might have more
       * collation elements than characters.
View Full Code Here


        doTest(comp);
    }


    public void testRuleComparator() {
        RuleBasedCollator comp = (RuleBasedCollator)RuleBasedCollator.getInstance();
        doTest(comp);
    }
View Full Code Here

    assertEquals(0, iterator.getOffset());
  }

  public void testGetMaxExpansion() {
    String text = "cha";
    RuleBasedCollator rbColl = (RuleBasedCollator) Collator
        .getInstance(new Locale("es", "", "TRADITIONAL"));
    CollationElementIterator iterator = rbColl
        .getCollationElementIterator(text);
    int order = iterator.next();
    while (order != CollationElementIterator.NULLORDER) {
      assertEquals(1, iterator.getMaxExpansion(order));
      order = iterator.next();
View Full Code Here

    }

  }

  public void testPrimaryOrder() {
    RuleBasedCollator rbColl = (RuleBasedCollator) Collator
        .getInstance(new Locale("de", "DE"));
    String text = "\u00e6";
    CollationElementIterator iterator = rbColl
        .getCollationElementIterator(text);
    int order = iterator.next();
    int pOrder = CollationElementIterator.primaryOrder(order);
    CollationElementIterator iterator2 = rbColl
        .getCollationElementIterator("ae");
    int order2 = iterator2.next();
    int pOrder2 = CollationElementIterator.primaryOrder(order2);
    assertEquals(pOrder, pOrder2);
  }
View Full Code Here

    int pOrder2 = CollationElementIterator.primaryOrder(order2);
    assertEquals(pOrder, pOrder2);
  }

  public void testSecondaryOrder() {
    RuleBasedCollator rbColl = (RuleBasedCollator) Collator
        .getInstance(new Locale("fr", "FR"));
    String text = "a\u00e0";
    CollationElementIterator iterator = rbColl
        .getCollationElementIterator(text);
    int order = iterator.next();
    int sOrder1 = CollationElementIterator.secondaryOrder(order);

    order = iterator.next();
View Full Code Here

    assertEquals(sOrder1, sOrder2);
  }

  public void testTertiaryOrder() {
    RuleBasedCollator rbColl = (RuleBasedCollator) Collator
        .getInstance(new Locale("fr", "FR"));
    String text = "abAB";
    CollationElementIterator iterator = rbColl
        .getCollationElementIterator(text);
    int order = iterator.next();
    int tOrder1 = CollationElementIterator.tertiaryOrder(order);
    order = iterator.next();
    int tOrder2 = CollationElementIterator.tertiaryOrder(order);
View Full Code Here

    tOrder2 = CollationElementIterator.tertiaryOrder(order);
    assertEquals(tOrder1, tOrder2);
  }

  public void testSetOffset() {
    RuleBasedCollator rbColl = (RuleBasedCollator) Collator
        .getInstance(new Locale("es", "", "TRADITIONAL"));
    String text = "cha";
    CollationElementIterator iterator = rbColl
        .getCollationElementIterator(text);
    iterator.setOffset(1);
    assertEquals(0, iterator.getOffset());
  }
View Full Code Here

  /*
   * Class under test for void setText(java.lang.String)
   */
  public void testSetTextString() {
    RuleBasedCollator rbColl = (RuleBasedCollator) Collator
        .getInstance(new Locale("es", "", "TRADITIONAL"));
    String text = "caa";
    CollationElementIterator iterator = rbColl
        .getCollationElementIterator(text);
    iterator.setOffset(1);
    assertEquals(1, iterator.getOffset());
    iterator.setText("cha");
    iterator.setOffset(1);
View Full Code Here

  /*
   * Class under test for void setText(java.text.CharacterIterator)
   */
  public void testSetTextCharacterIterator() {
    RuleBasedCollator rbColl = (RuleBasedCollator) Collator
        .getInstance(new Locale("es", "", "TRADITIONAL"));
    String text = "caa";
    CollationElementIterator iterator = rbColl
        .getCollationElementIterator(text);
    iterator.setOffset(1);
    assertEquals(1, iterator.getOffset());
    iterator.setText(new StringCharacterIterator("cha"));
    iterator.setOffset(1);
View Full Code Here

public class RuleBasedCollatorTest extends TestCase {

  public void test_getCollationKeyLjava_lang_String() {
    // Regression test for HARMONY-28
    String source = null;
    RuleBasedCollator rbc = null;
    try {
      String Simple = "< a< b< c< d";
      rbc = new RuleBasedCollator(Simple);
    } catch (ParseException e) {
      fail("Assert 0: Unexpected format exception " + e);
    }
    CollationKey ck = rbc.getCollationKey(source);
    assertNull("Assert 1: getCollationKey (null) does not return null", ck);
  }
View Full Code Here

TOP

Related Classes of java.text.RuleBasedCollator$CollationSorter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.