Package java.text

Examples of java.text.CollationKey


   *       1 - this > str2
   */
  protected int stringCollatorCompare(SQLChar str2)
    throws StandardException
 
    CollationKey ckey1 = this.getCollationKey();
    CollationKey ckey2 = str2.getCollationKey();

   
    /*
    ** By convention, nulls sort High, and null == null
    */
 
View Full Code Here


   * Implementation of hashCode() for the national character types,
   * put here to make it accessible to all the national types.
   */
  protected int nationalHashCode()
  {
    CollationKey tmpCKey = null;

    try
    {
      tmpCKey = getCollationKey();
    }
    catch (StandardException se)
    {
      if (SanityManager.DEBUG)
      {
        SanityManager.THROWASSERT("Unexpected exception " + se);
      }
    }

    if (tmpCKey == null)
      return 0;
    return tmpCKey.hashCode();
  }
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

        private final Collator collator = Collator.getInstance();

        @Override
        public int compare(Path o1, Path o2)
        {
            CollationKey key1 = collator.getCollationKey(o1.toString());
            CollationKey key2 = collator.getCollationKey(o2.toString());
            return key1.compareTo(key2);
        }
View Full Code Here

        private final Collator collator = Collator.getInstance();

        @Override
        public int compare(File o1, File o2)
        {
            CollationKey key1 = collator.getCollationKey(o1.getAbsolutePath());
            CollationKey key2 = collator.getCollationKey(o2.getAbsolutePath());
            return key1.compareTo(key2);
        }
View Full Code Here

        private final Collator collator = Collator.getInstance();

        @Override
        public int compare(String o1, String o2)
        {
            CollationKey key1 = collator.getCollationKey(o1);
            CollationKey key2 = collator.getCollationKey(o2);
            return key1.compareTo(key2);
        }
View Full Code Here

            if (diff != 0)
            {
                return diff;
            }
            // then by name (not really needed, but makes for predictable test cases)
            CollationKey k1 = collator.getCollationKey(o1.fileRef);
            CollationKey k2 = collator.getCollationKey(o2.fileRef);
            return k1.compareTo(k2);
        }
View Full Code Here

        @Override
        public int compare(Module o1, Module o2)
        {
            // by name (not really needed, but makes for predictable test cases)
            CollationKey k1 = collator.getCollationKey(o1.fileRef);
            CollationKey k2 = collator.getCollationKey(o2.fileRef);
            return k1.compareTo(k2);
        }
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.