Package java.text

Examples of java.text.CollationKey


            if (o2.getName().equals(TOPNODE))
            {
                return 1;
            }

            CollationKey key1 = toKey(o1);
            CollationKey key2 = toKey(o2);
            return key1.compareTo(key2);
        }
View Full Code Here


    int result;


    if (comparator instanceof Collator) {
      CollationKey collationKey1
          = ((Collator) comparator).getCollationKey(obj1.toString());
      CollationKey collationKey2
          = ((Collator) comparator).getCollationKey(obj2.toString());
      result = collationKey1.compareTo(collationKey2);

    } else if (comparator != null) {
      result = comparator.compare(obj1, obj2);
View Full Code Here

   *       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

                        : (diff > 0.0) ? (k.m_descending ? -1 : 1) : 0);
      }
    }  // end treat as numbers
    else
    {
      CollationKey n1String, n2String;

      if (kIndex == 0)
      {
        n1String = (CollationKey) n1.m_key1Value;
        n2String = (CollationKey) n2.m_key1Value;
      }
      else if (kIndex == 1)
      {
        n1String = (CollationKey) n1.m_key2Value;
        n2String = (CollationKey) n2.m_key2Value;
      }

      /* Leave this in case we decide to use an array later
      if (kIndex < maxkey)
      {
        String n1String = (String)n1.m_keyValue[kIndex];
        String n2String = (String)n2.m_keyValue[kIndex];
      }*/
      else
      {

        // Get values dynamically
        XObject r1 = k.m_selectPat.execute(m_execContext, n1.m_node,
                                           k.m_namespaceContext);
        XObject r2 = k.m_selectPat.execute(m_execContext, n2.m_node,
                                           k.m_namespaceContext);

        n1String = k.m_col.getCollationKey(r1.str());
        n2String = k.m_col.getCollationKey(r2.str());
      }

      // Use collation keys for faster compare, but note that whitespaces
      // etc... are treated differently from if we were comparing Strings.
      result = n1String.compareTo(n2String);

      //Process caseOrder parameter
      if (k.m_caseOrderUpper)
      {
        String tempN1 = n1String.getSourceString().toLowerCase();
        String tempN2 = n2String.getSourceString().toLowerCase();

        if (tempN1.equals(tempN2))
        {

View Full Code Here

    final int result;


    if (comparator instanceof Collator) {
      final CollationKey collationKey1
          = ((Collator) comparator).getCollationKey(obj1.toString());
      final CollationKey collationKey2
          = ((Collator) comparator).getCollationKey(obj2.toString());
      result = collationKey1.compareTo(collationKey2);

    } else if (comparator != null) {
      result = comparator.compare(obj1, obj2);
View Full Code Here

            fCurrentStart = fCurrentLimit;
            fCurrentLimit = fBreakIter.next();
           
            String word = fText.substring(fCurrentStart, fCurrentLimit);
            CollationKey ck = fCollator.getCollationKey(word);
            fCurrentStyle = (AttributeMap) fStyleMap.get(ck);
            if (fCurrentStyle == null) {
                fCurrentStyle = AttributeMap.EMPTY_ATTRIBUTE_MAP;
            }
           
View Full Code Here

            a = a.toUpperCase();
            b = b.toUpperCase();
        }
        int comp;
        if (collationKeys != null) {
            CollationKey aKey = getKey(a);
            CollationKey bKey = getKey(b);
            comp = aKey.compareTo(bKey);
        } else {
            comp = collator.compare(a, b);
        }
        return comp;
View Full Code Here

        return compareString(a.substring(ai, ai + 1), b.substring(bi, bi + 1), ignoreCase) == 0;
    }

    private CollationKey getKey(String a) {
        synchronized (collationKeys) {
            CollationKey key = collationKeys.get(a);
            if (key == null) {
                key = collator.getCollationKey(a);
                collationKeys.put(a, key);
            }
            return key;
View Full Code Here

            // This happens if the object at rowIndex zero is null.
            // So test before we cast:
           
            if (value1 instanceof String) {
                //if the object is a String we best compare locale-sesitive
                CollationKey collationKey1 = getCollationKey((String)value1);
                CollationKey collationKey2 = getCollationKey((String)value2);
               
                return collationKey1.compareTo(collationKey2);
            }
            else if (value1 instanceof Comparable)
            {
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.