org.eigenbase.sql.type
Class SqlTypeExplicitPrecedenceList

java.lang.Object
  extended by org.eigenbase.sql.type.SqlTypeExplicitPrecedenceList
All Implemented Interfaces:
RelDataTypePrecedenceList

public class SqlTypeExplicitPrecedenceList
extends Object
implements RelDataTypePrecedenceList

SqlTypeExplicitPrecedenceList implements the RelDataTypePrecedenceList interface via an explicit list of SqlTypeName entries.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/sql/type/SqlTypeExplicitPrecedenceList.java#11 $
Author:
John V. Sichi

Field Summary
private  List<SqlTypeName> typeNames
           
private static Map<SqlTypeName,SqlTypeExplicitPrecedenceList> typeNameToPrecedenceList
          Map from SqlTypeName to corresponding precedence list.
 
Constructor Summary
SqlTypeExplicitPrecedenceList(SqlTypeName[] typeNames)
           
 
Method Summary
private static void addList(SqlTypeName typeName, SqlTypeName[] array)
           
private static void addNumericList(SqlTypeName typeName, List<SqlTypeName> numericList)
           
 int compareTypePrecedence(RelDataType type1, RelDataType type2)
          Compares the precedence of two types.
 boolean containsType(RelDataType type)
          Determines whether a type appears in this precedence list.
(package private) static RelDataTypePrecedenceList getListForType(RelDataType type)
           
private static int getListPosition(SqlTypeName type, List<SqlTypeName> list)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

typeNameToPrecedenceList

private static final Map<SqlTypeName,SqlTypeExplicitPrecedenceList> typeNameToPrecedenceList
Map from SqlTypeName to corresponding precedence list.

Reference to SQL:2003 standard:
Part 2 Section 9.5

typeNames

private final List<SqlTypeName> typeNames
Constructor Detail

SqlTypeExplicitPrecedenceList

public SqlTypeExplicitPrecedenceList(SqlTypeName[] typeNames)
Method Detail

addList

private static void addList(SqlTypeName typeName,
                            SqlTypeName[] array)

addNumericList

private static void addNumericList(SqlTypeName typeName,
                                   List<SqlTypeName> numericList)

containsType

public boolean containsType(RelDataType type)
Description copied from interface: RelDataTypePrecedenceList
Determines whether a type appears in this precedence list.

Specified by:
containsType in interface RelDataTypePrecedenceList
Parameters:
type - type to check
Returns:
true iff this list contains type

compareTypePrecedence

public int compareTypePrecedence(RelDataType type1,
                                 RelDataType type2)
Description copied from interface: RelDataTypePrecedenceList
Compares the precedence of two types.

Specified by:
compareTypePrecedence in interface RelDataTypePrecedenceList
Parameters:
type1 - first type to compare
type2 - second type to compare
Returns:
positive if type1 has higher precedence; negative if type2 has higher precedence; 0 if types have equal precedence

getListPosition

private static int getListPosition(SqlTypeName type,
                                   List<SqlTypeName> list)

getListForType

static RelDataTypePrecedenceList getListForType(RelDataType type)