org.apache.derby.iapi.types
Class WorkHorseForCollatorDatatypes

java.lang.Object
  extended by org.apache.derby.iapi.types.WorkHorseForCollatorDatatypes

final class WorkHorseForCollatorDatatypes
extends java.lang.Object

WorkHorseForCollatorDatatypes class holds on to RuleBasedCollator, and the base SQLChar object for the collation sensitive SQLChar, SQLVarchar, SQLLongvarchar and SQLClob. This class uses RuleBasedCollator and SQLChar object in the collation sensitive methods to do the comparison. The reason for encapsulating this here is that the collation version of SQLChar, SQLVarchar, SQLLongvarchar and SQLClob do not all have to duplicate the code for collation sensitive methods. Instead, they can simply delegate the work to methods defined in this class.


Field Summary
private  java.text.CollationKey cKey
           
private  int[] collationElementsForString
          Following is the array holding a series of collation elements for the string.
private  java.text.RuleBasedCollator collatorForCharacterDatatypes
          Use this object for collation on character datatype.
private  int countOfCollationElements
          Number of valid collation elements in the array above.
private  SQLChar stringData
          collatorForCharacterDatatypes will be used on this SQLChar to determine collationElementsForString.
 
Constructor Summary
WorkHorseForCollatorDatatypes(java.text.RuleBasedCollator collatorForCharacterDatatypes, SQLChar stringData)
           
 
Method Summary
(package private)  int[] getCollationElementsForString()
          This method translates the string into a series of collation elements.
(package private)  java.text.RuleBasedCollator getCollatorForCollation()
          Get the RuleBasedCollator which is getting used for collation sensitive methods.
(package private)  int getCountOfCollationElements()
          This method returns the count of collation elements for SQLChar object.
(package private)  BooleanDataValue like(DataValueDescriptor pattern)
          This method implements the like function for char (with no escape value).
(package private)  BooleanDataValue like(DataValueDescriptor pattern, DataValueDescriptor escape)
          This method implements the like function for char with an escape value.
(package private)  int stringCompare(SQLChar str1, SQLChar str2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

collatorForCharacterDatatypes

private java.text.RuleBasedCollator collatorForCharacterDatatypes
Use this object for collation on character datatype. This collator object is passed as a parameter to the constructor.


stringData

private SQLChar stringData
collatorForCharacterDatatypes will be used on this SQLChar to determine collationElementsForString. The collationElementsForString is used by the like method to do Collator specific comparison. This SQLChar object is passed as a parameter to the constructor.


collationElementsForString

private int[] collationElementsForString
Following is the array holding a series of collation elements for the string. It will be used in the like method. This gets initialized when the like method is first invoked.


countOfCollationElements

private int countOfCollationElements
Number of valid collation elements in the array above. Note that this might be smaller than the actual size of the array above. Gets initialized when the like method is first invoked.


cKey

private java.text.CollationKey cKey
Constructor Detail

WorkHorseForCollatorDatatypes

WorkHorseForCollatorDatatypes(java.text.RuleBasedCollator collatorForCharacterDatatypes,
                              SQLChar stringData)
Method Detail

stringCompare

int stringCompare(SQLChar str1,
                  SQLChar str2)
            throws StandardException
Throws:
StandardException
See Also:
SQLChar.stringCompare(SQLChar, SQLChar)

like

BooleanDataValue like(DataValueDescriptor pattern)
                throws StandardException
This method implements the like function for char (with no escape value). The difference in this method and the same method in SQLChar is that here we use special Collator object to do the comparison rather than using the Collator object associated with the default jvm locale.

Parameters:
pattern - The pattern to use
Returns:
A SQL boolean value telling whether the first operand is like the second operand
Throws:
StandardException - Thrown on error

like

BooleanDataValue like(DataValueDescriptor pattern,
                      DataValueDescriptor escape)
                throws StandardException
This method implements the like function for char with an escape value.

Parameters:
pattern - The pattern to use
Returns:
A SQL boolean value telling whether the first operand is like the second operand
Throws:
StandardException - Thrown on error

getCollatorForCollation

java.text.RuleBasedCollator getCollatorForCollation()
Get the RuleBasedCollator which is getting used for collation sensitive methods.


getCountOfCollationElements

int getCountOfCollationElements()
This method returns the count of collation elements for SQLChar object. It method will return the correct value only if method getCollationElementsForString has been called previously on the SQLChar object.

Returns:
count of collation elements for this instance of CollatorSQLChar

getCollationElementsForString

int[] getCollationElementsForString()
                              throws StandardException
This method translates the string into a series of collation elements. These elements will get used in the like method.

Returns:
an array of collation elements for the string
Throws:
StandardException

Built on Thu 2011-03-10 11:54:14+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.