Package java.text

Examples of java.text.CollationKey


                return value1.toString().compareTo(value2.toString());
            }
        }        
       
        private CollationKey getCollationKey(String propertyValue) {
            CollationKey key = (CollationKey)_collationKeys.get(propertyValue);
            if (key == null) {
                key = _collator.getCollationKey(propertyValue);
                _collationKeys.put(propertyValue, key);
            }
               
View Full Code Here


      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

    public void testGetCollationKey() {
        RuleBasedCollator coll = (RuleBasedCollator) Collator
                .getInstance(Locale.GERMAN);
        String source = "abc";
        CollationKey key1 = coll.getCollationKey(source);
        assertEquals(source, key1.getSourceString());
        String source2 = "abb";
        CollationKey key2 = coll.getCollationKey(source2);
        assertEquals(source2, key2.getSourceString());
        assertTrue(key1.compareTo(key2) > 0);
        assertTrue(coll.compare(source, source2) > 0);

    }
View Full Code Here

    // Test CollationKey
    public void testCollationKey() {
        Collator coll = Collator.getInstance(Locale.US);
        String text = "abc";
        CollationKey key = coll.getCollationKey(text);
        key.hashCode();

        CollationKey key2 = coll.getCollationKey("abc");

        assertEquals(0, key.compareTo(key2));
    }
View Full Code Here

   * @tests java.text.CollationKey#compareTo(java.text.CollationKey)
   */
  public void test_compareToLjava_text_CollationKey() {
    Collator collator = Collator.getInstance();
    collator.setStrength(Collator.PRIMARY);
    CollationKey key1 = collator.getCollationKey("abc");
    CollationKey key2 = collator.getCollationKey("ABC");
    assertEquals("Should be equal", 0, key1.compareTo(key2));
  }
View Full Code Here

  public void test_compareToLjava_lang_Object() {
    // Test for method int
    // java.text.CollationKey.compareTo(java.lang.Object)
    Collator collator = Collator.getInstance();
    collator.setStrength(Collator.PRIMARY);
    CollationKey key1 = collator.getCollationKey("abc");
    CollationKey key2 = collator.getCollationKey("ABC");
    assertEquals("Should be equal", 0, key1.compareTo(key2));
  }
View Full Code Here

   * @tests java.text.CollationKey#equals(java.lang.Object)
   */
  public void test_equalsLjava_lang_Object() {
    Collator collator = Collator.getInstance();
    collator.setStrength(Collator.PRIMARY);
    CollationKey key1 = collator.getCollationKey("abc");
    CollationKey key2 = collator.getCollationKey("ABC");
    assertTrue("Should be equal", key1.equals(key2));
  }
View Full Code Here

   * @tests java.text.CollationKey#hashCode()
   */
  public void test_hashCode() {
    Collator collator = Collator.getInstance();
    collator.setStrength(Collator.PRIMARY);
    CollationKey key1 = collator.getCollationKey("abc");
    CollationKey key2 = collator.getCollationKey("ABC");
    assertTrue("Should be equal", key1.hashCode() == key2.hashCode());
  }
View Full Code Here

    //FIXME This test fails on Harmony ClassLibrary
  public void failing_test_toByteArray() {
    // Test for method byte [] java.text.CollationKey.toByteArray()
    Collator collator = Collator.getInstance();
    collator.setStrength(Collator.PRIMARY);
    CollationKey key1 = collator.getCollationKey("abc");
    byte[] bytes = key1.toByteArray();
    assertTrue("Not enough bytes", bytes.length >= 3);

    try {
      collator = new RuleBasedCollator("= 1 , 2 ; 3 , 4 < 5 ; 6 , 7");
    } catch (ParseException e) {
View Full Code Here

 
  /** @see SQLChar#stringCompare(SQLChar, SQLChar) */
  int stringCompare(SQLChar str1, SQLChar str2)
  throws StandardException
  {
    CollationKey ckey1 = str1.getCollationKey();
    CollationKey ckey2 = str2.getCollationKey();
   
    /*
    ** By convention, nulls sort High, and null == null
    */
    if (ckey1 == null || ckey2 == null)
View Full Code Here

TOP

Related Classes of java.text.CollationKey

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.