Package java.text

Examples of java.text.CollationKey


 
  /** @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


    /**
     * Hash code implementation for collator sensitive subclasses.
     */
    int hashCodeForCollation() {
        CollationKey key = null;

        try {
            key = getCollationKey();
        } catch (StandardException se) {
            // ignore exceptions, like we do in hashCode()
            if (SanityManager.DEBUG) {
                SanityManager.THROWASSERT("Unexpected exception", se);
            }
        }

        return key == null ? 0 : key.hashCode();
    }
View Full Code Here

  // Get value from our array if possible
  if (_scanned <= level) {
      // Get value from DOM if accessed for the first time
      final String str = extractValueFromDOM(_dom, _node, level,
               _translet, _last);
      final CollationKey key = _collator.getCollationKey(str);
      _values[_scanned++] = key;
      return(key);
  }
  return((CollationKey)_values[level]);
    }
View Full Code Here

    final Double our = numericValue(level);
    final Double their = other.numericValue(level);
    cmp = our.compareTo(their);
      }
      else {
    final CollationKey our = stringValue(level);
    final CollationKey their = other.stringValue(level);
    cmp = our.compareTo(their);
      }
     
      // Return inverse compare value if inverse sort order
      if (cmp != 0) {
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

 
  /** @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

    /**
     * Hash code implementation for collator sensitive subclasses.
     */
    int hashCodeForCollation() {
        CollationKey key = null;

        try {
            key = getCollationKey();
        } catch (StandardException se) {
            // ignore exceptions, like we do in hashCode()
            if (SanityManager.DEBUG) {
                SanityManager.THROWASSERT("Unexpected exception", se);
            }
        }

        return key == null ? 0 : key.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

 
  /** @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

    /**
     * Hash code implementation for collator sensitive subclasses.
     */
    int hashCodeForCollation() {
        CollationKey key = null;

        try {
            key = getCollationKey();
        } catch (StandardException se) {
            // ignore exceptions, like we do in hashCode()
            if (SanityManager.DEBUG) {
                SanityManager.THROWASSERT("Unexpected exception", se);
            }
        }

        return key == null ? 0 : key.hashCode();
    }
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.