db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r1495305 [4/21] - in /db/derby/code/trunk: java/engine/org/apache/derby/ java/engine/org/apache/derby/catalog/types/ java/engine/org/apache/derby/iapi/services/io/ java/engine/org/apache/derby/iapi/sql/ java/engine/org/apache/derby/iapi/sql...
Date Fri, 21 Jun 2013 07:47:52 GMT
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CharTypeCompiler.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CharTypeCompiler.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CharTypeCompiler.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CharTypeCompiler.java Fri Jun 21 07:47:47 2013
@@ -21,21 +21,14 @@
 
 package org.apache.derby.impl.sql.compile;
 
+import org.apache.derby.iapi.reference.ClassName;
+import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.services.loader.ClassFactory;
-
 import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.iapi.services.compiler.LocalField;
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
-import org.apache.derby.iapi.services.io.StoredFormatIds;
-
+import org.apache.derby.iapi.sql.compile.TypeCompiler;
+import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.StringDataValue;
 import org.apache.derby.iapi.types.TypeId;
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-
-import org.apache.derby.iapi.sql.compile.TypeCompiler;
-
-import org.apache.derby.iapi.reference.ClassName;
 
 /**
  * This class implements TypeCompiler for the SQL char datatypes.
@@ -87,108 +80,113 @@ public final class CharTypeCompiler exte
 		
 	}
 
-        /**
-         * Tell whether this type (char) can be stored into from the given type.
-         *
-         * @param otherType     The TypeId of the other type.
-         * @param cf            A ClassFactory
+    /**
+     * Tell whether this type (char) can be stored into from the given type.
+     *
+     * @param otherType     The TypeId of the other type.
+     * @param cf            A ClassFactory
+     */
+
+    public boolean storable(TypeId otherType, ClassFactory cf)
+    {
+        // Same rules as cast except we can't assign from numbers
+        if (convertible(otherType,false) &&
+                !otherType.isBlobTypeId() &&
+                !otherType.isNumericTypeId())
+            return true;
+
+        /*
+         ** If the other type is user-defined, use the java types to determine
+         ** assignability.
          */
+        return userTypeStorable(getTypeId(), otherType, cf);
+    }
 
-        public boolean storable(TypeId otherType, ClassFactory cf)
-        {
-				// Same rules as cast except we can't assign from numbers
-				if (convertible(otherType,false) && 
-					!otherType.isBlobTypeId() &&
-					!otherType.isNumericTypeId())
-						return true;
-
-                /*
-                ** If the other type is user-defined, use the java types to determine
-                ** assignability.
-                */
-                return userTypeStorable(getTypeId(), otherType, cf);
-        }
+    /** @see TypeCompiler#interfaceName */
+    public String interfaceName()
+    {
+        return ClassName.StringDataValue;
+    }
+
+    /**
+     * @see TypeCompiler#getCorrespondingPrimitiveTypeName
+     */
+
+    public String getCorrespondingPrimitiveTypeName()
+    {
+        /* Only numerics and booleans get mapped to Java primitives */
+        return "java.lang.String";
+    }
+
+    /**
+     * @see TypeCompiler#getCastToCharWidth
+     */
+    public int getCastToCharWidth(DataTypeDescriptor dts)
+    {
+        return dts.getMaximumWidth();
+    }
+
+    String nullMethodName()
+    {
+        int formatId = getStoredFormatIdFromTypeId();
+        switch (formatId)
+        {
+            case StoredFormatIds.CHAR_TYPE_ID:
+                return "getNullChar";
 
-        /** @see TypeCompiler#interfaceName */
-        public String interfaceName()
-        {
-                return ClassName.StringDataValue;
-        }
+            case StoredFormatIds.LONGVARCHAR_TYPE_ID:
+                return "getNullLongvarchar";
 
-        /**
-         * @see TypeCompiler#getCorrespondingPrimitiveTypeName
-         */
+            case StoredFormatIds.VARCHAR_TYPE_ID:
+                return "getNullVarchar";
 
-        public String getCorrespondingPrimitiveTypeName()
-        {
-                /* Only numerics and booleans get mapped to Java primitives */
-                return "java.lang.String";
-        }
-
-        /**
-         * @see TypeCompiler#getCastToCharWidth
-         */
-        public int getCastToCharWidth(DataTypeDescriptor dts)
-        {
-                return dts.getMaximumWidth();
-        }
-
-        String nullMethodName()
-        {
-                int formatId = getStoredFormatIdFromTypeId();
-                switch (formatId)
+            default:
+                if (SanityManager.DEBUG)
                 {
-                        case StoredFormatIds.CHAR_TYPE_ID:
-                                return "getNullChar";
-
-                        case StoredFormatIds.LONGVARCHAR_TYPE_ID:
-                                return "getNullLongvarchar";
-
-                        case StoredFormatIds.VARCHAR_TYPE_ID:
-                                return "getNullVarchar";
-
-                        default:
-                                if (SanityManager.DEBUG)
-                                {
-                                        SanityManager.THROWASSERT(
-                                                "unexpected formatId in nullMethodName() - " + formatId);
-                                }
-                                return null;
+                    SanityManager.THROWASSERT(
+                        "unexpected formatId in nullMethodName() - " +
+                        formatId);
                 }
+                return null;
         }
+    }
 
-        /**
-         * Push the collation type if it is not COLLATION_TYPE_UCS_BASIC.
-         * 
-         * @param collationType Collation type of character values.
-         * @return true collationType will be pushed, false collationType will be ignored.
-         */
-        boolean pushCollationForDataValue(int collationType)
-        {
-            return collationType != StringDataValue.COLLATION_TYPE_UCS_BASIC;
-        }
+    /**
+     * Push the collation type if it is not COLLATION_TYPE_UCS_BASIC.
+     *
+     * @param collationType Collation type of character values.
+     * @return {@code true} collationType will be pushed, {@code
+     *         false} collationType will be ignored.
+     */
+    @Override
+    boolean pushCollationForDataValue(int collationType)
+    {
+        return collationType != StringDataValue.COLLATION_TYPE_UCS_BASIC;
+    }
+
+    @Override
+    String dataValueMethodName()
+    {
+        int formatId = getStoredFormatIdFromTypeId();
+        switch (formatId)
+        {
+            case StoredFormatIds.CHAR_TYPE_ID:
+                return "getCharDataValue";
 
-        String dataValueMethodName()
-        {
-                int formatId = getStoredFormatIdFromTypeId();
-                switch (formatId)
-                {
-                        case StoredFormatIds.CHAR_TYPE_ID:
-                                return "getCharDataValue";
+            case StoredFormatIds.LONGVARCHAR_TYPE_ID:
+                return "getLongvarcharDataValue";
 
-                        case StoredFormatIds.LONGVARCHAR_TYPE_ID:
-                                return "getLongvarcharDataValue";
+            case StoredFormatIds.VARCHAR_TYPE_ID:
+                return "getVarcharDataValue";
 
-                        case StoredFormatIds.VARCHAR_TYPE_ID:
-                                return "getVarcharDataValue";
-
-                        default:
-                                if (SanityManager.DEBUG)
-                                {
-                                        SanityManager.THROWASSERT(
-                                                "unexpected formatId in dataValueMethodName() - " + formatId);
-                                }
-                                return null;
+            default:
+                if (SanityManager.DEBUG)
+                {
+                    SanityManager.THROWASSERT(
+                        "unexpected formatId in dataValueMethodName() - " +
+                        formatId);
                 }
+                return null;
         }
+    }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java Fri Jun 21 07:47:47 2013
@@ -21,25 +21,20 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import java.lang.reflect.Modifier;
+import java.util.List;
+import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.ClassName;
 import org.apache.derby.iapi.reference.SQLState;
-
 import org.apache.derby.iapi.services.classfile.VMOpcode;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.iapi.error.StandardException;
-
 import org.apache.derby.iapi.services.compiler.LocalField;
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.Visitor;
-
 import org.apache.derby.iapi.util.JBitSet;
 
-import java.lang.reflect.Modifier;
-
-import java.util.List;
-
 /**
  * This node represents coalesce/value function which returns the first argument that is not null.
  * The arguments are evaluated in the order in which they are specified, and the result of the
@@ -54,15 +49,15 @@ import java.util.List;
  * This table has FOR BIT DATA TYPES broken out into separate columns for clarity
  *
  * Note that are few differences between Derby and DB2
- * 1)there are few differences between what datatypes are consdiered compatible
- * In DB2, CHAR FOR BIT DATA datatypes are compatible with CHAR datatypes
+ * 1)there are few differences between what data types are considered compatible
+ * In DB2, CHAR FOR BIT DATA data types are compatible with CHAR data types
  * ie in addition to following table, CHAR is compatible with CHAR FOR BIT DATA, VARCHAR FOR BIT DATA and LONG VARCHAR FOR BIT DATA
  * ie in addition to following table, VARCHAR is compatible with CHAR FOR BIT DATA, VARCHAR FOR BIT DATA and LONG VARCHAR FOR BIT DATA
  * ie in addition to following table, LONG VARCHAR is compatible with CHAR FOR BIT DATA, VARCHAR FOR BIT DATA and LONG VARCHAR FOR BIT DATA
  * ie in addition to following table, CHAR FOR BIT DATA is compatible with DATE, TIME, TIMESTAMP
  * ie in addition to following table, VARCHAR FOR BIT DATA is compatible with DATE, TIME, TIMESTAMP
  *
- * 2)few datatypes donot have matching precision in Derby and DB2
+ * 2)few data types do not have matching precision in Derby and DB2
  * In DB2, precision of TIME is 8. In Derby, precision of TIME is 0.
  * In DB2, precision,scale of TIMESTAMP is 26,6. In Derby, precision of TIMESTAMP is 0,0.
  * In DB2, precision of DOUBLE is 15. In Derby, precision of DOUBLE is 52.
@@ -100,7 +95,7 @@ import java.util.List;
  * BLOB             { "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "BLOB" }
  */
 
-public class CoalesceFunctionNode extends ValueNode
+class CoalesceFunctionNode extends ValueNode
 {
 	String	functionName; //Are we here because of COALESCE function or VALUE function
 	ValueNodeList	argumentsList; //this is the list of arguments to the function. We are interested in the first not-null argument
@@ -112,15 +107,21 @@ public class CoalesceFunctionNode extend
 	private int firstNonParameterNodeIdx = -1;
 
 	/**
-	 * Initializer for a CalesceFunctionNode
+     * Constructor for a CoalesceFunctionNode
 	 *
 	 * @param functionName	Tells if the function was called with name COALESCE or with name VALUE
 	 * @param argumentsList	The list of arguments to the coalesce/value function
+     * @param cm            The context manager
 	 */
-	public void init(Object functionName, Object argumentsList)
+    CoalesceFunctionNode(
+            String functionName,
+            ValueNodeList argumentsList,
+            ContextManager cm)
 	{
-		this.functionName = (String) functionName;
-		this.argumentsList = (ValueNodeList) argumentsList;
+        super(cm);
+        this.functionName = functionName;
+        this.argumentsList = argumentsList;
+        setNodeType(C_NodeTypes.COALESCE_FUNCTION_NODE);
 	}
 
 	/**
@@ -135,6 +136,7 @@ public class CoalesceFunctionNode extend
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
     ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)
 					throws StandardException
 	{
@@ -191,7 +193,7 @@ public class CoalesceFunctionNode extend
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
     void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
 									throws StandardException
 	{
@@ -313,6 +315,7 @@ public class CoalesceFunctionNode extend
 	/*
 		print the non-node subfields
 	 */
+    @Override
 	public String toString() 
 	{
 		if (SanityManager.DEBUG)
@@ -334,8 +337,8 @@ public class CoalesceFunctionNode extend
 	 *
 	 * @param depth		The depth of this node in the tree
 	 */
-
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -373,6 +376,7 @@ public class CoalesceFunctionNode extend
 	 * @param v the visitor
 	 * @throws StandardException on error in the visitor
 	 */
+    @Override
 	void acceptChildren(Visitor v) throws StandardException
 	{
 		super.acceptChildren(v);
@@ -385,6 +389,7 @@ public class CoalesceFunctionNode extend
      *
      * @see ValueNode#categorize(JBitSet, boolean)
      */
+    @Override
     public boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly)
         throws StandardException
     {
@@ -406,7 +411,8 @@ public class CoalesceFunctionNode extend
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ValueNode preprocess(int numTables,
+    @Override
+    ValueNode preprocess(int numTables,
 								FromList outerFromList,
 								SubqueryList outerSubqueryList,
 								PredicateList outerPredicateList) 
@@ -428,6 +434,7 @@ public class CoalesceFunctionNode extend
      * @return the remapped tree
      * @throws StandardException if an error occurs
      */
+    @Override
     public ValueNode remapColumnReferencesToExpressions()
             throws StandardException
     {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java Fri Jun 21 07:47:47 2013
@@ -29,6 +29,7 @@ import org.apache.derby.catalog.types.De
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.Limits;
 import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.services.loader.ClassInspector;
 import org.apache.derby.iapi.services.sanity.SanityManager;
@@ -88,25 +89,27 @@ public class ColumnDefinitionNode extend
 	public static final int MODIFY_AUTOINCREMENT_INC_VALUE = 2;
 	
 	/**
-	 * Initializer for a ColumnDefinitionNode
+     * Constructor for a ColumnDefinitionNode
 	 *
 	 * @param name			The name of the column
 	 * @param defaultNode	The default value of the column
 	 * @param dataTypeServices	A DataTypeServices telling the type
 	 *				of the column
-	 * @param autoIncrementInfo	Info for autoincrement columns
-	 *
+     * @param autoIncrementInfo Info for auto-increment columns
+     * @param cm            The context manager
 	 */
 
-	public void init(
-					Object name,
-					Object defaultNode,
-					Object dataTypeServices,
-					Object autoIncrementInfo)
+    ColumnDefinitionNode(
+                    String name,
+                    ValueNode defaultNode,
+                    DataTypeDescriptor dataTypeServices,
+                    long[] autoIncrementInfo,
+                    ContextManager cm)
 		throws StandardException
 	{
-		super.init(name);
-		this.type = (DataTypeDescriptor) dataTypeServices;
+        super(name, cm);
+        setNodeType(C_NodeTypes.COLUMN_DEFINITION_NODE);
+        this.type = dataTypeServices;
 		if (defaultNode instanceof UntypedNullConstantNode)
 		{
 			/* No DTS yet for MODIFY DEFAULT */
@@ -136,7 +139,7 @@ public class ColumnDefinitionNode extend
 			this.defaultNode = (DefaultNode) defaultNode;
 			if (autoIncrementInfo != null)
 			{
-				long[] aii = (long[]) autoIncrementInfo;
+                long[] aii = autoIncrementInfo;
 				autoincrementStart = aii[QueryTreeNode.AUTOINCREMENT_START_INDEX];
 				autoincrementIncrement = aii[QueryTreeNode.AUTOINCREMENT_INC_INDEX];
 				//Parser has passed the info about autoincrement column's status in the
@@ -180,7 +183,7 @@ public class ColumnDefinitionNode extend
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
@@ -200,7 +203,7 @@ public class ColumnDefinitionNode extend
 	 *
 	 * @return	the name of the column
 	 */
-	public String getColumnName()
+    String getColumnName()
 	{
 		return this.name;
 	}
@@ -210,7 +213,7 @@ public class ColumnDefinitionNode extend
 	 *
 	 * @return	the data type of the column
 	 */
-	public final DataTypeDescriptor getType()
+    final DataTypeDescriptor getType()
 	{
 		return type;
 	}
@@ -221,7 +224,7 @@ public class ColumnDefinitionNode extend
     /**
      * Set the nullability of the column definition node.
       */
-    void setNullability(boolean nullable)
+    final void setNullability(boolean nullable)
     {
         type = getType().getNullabilityType(nullable);
     }
@@ -243,7 +246,7 @@ public class ColumnDefinitionNode extend
 	 * @return	The default value of the column
 	 */
 
-	public DataValueDescriptor getDefaultValue()
+    DataValueDescriptor getDefaultValue()
 	{
 		return this.defaultValue;
 	}
@@ -255,7 +258,7 @@ public class ColumnDefinitionNode extend
 	 * @return	The default info for the column
 	 */
 
-	public DefaultInfo getDefaultInfo()
+    DefaultInfo getDefaultInfo()
 	{
 		return defaultInfo;
 	}
@@ -270,7 +273,7 @@ public class ColumnDefinitionNode extend
 	 *
 	 * @return The DefaultNode, if any, associated with this node.
 	 */
-	public DefaultNode getDefaultNode()
+    DefaultNode getDefaultNode()
 	{
 		return defaultNode;
 	}
@@ -283,14 +286,16 @@ public class ColumnDefinitionNode extend
 	/**
 	 * Get the generation clause.
 	 */
-	public GenerationClauseNode getGenerationClauseNode() { return generationClauseNode; }
+    GenerationClauseNode getGenerationClauseNode() {
+        return generationClauseNode;
+    }
 
 	/**
 	 * Is this an autoincrement column?
 	 *
 	 * @return Whether or not this is an autoincrement column.
 	 */
-	public boolean isAutoincrementColumn()
+    boolean isAutoincrementColumn()
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -372,7 +377,7 @@ public class ColumnDefinitionNode extend
 	 * @exception StandardException		Thrown on error
 	 */
 
-	public void checkUserType(TableDescriptor td) 
+    void checkUserType(TableDescriptor td)
 		throws StandardException
 	{
 		String			columnTypeName;
@@ -492,8 +497,9 @@ public class ColumnDefinitionNode extend
 	 * 				if increment is 0 or if initial or increment values are out
 	 * 				of range for the datatype.
 	 */
-	public void validateAutoincrement(DataDictionary dd, TableDescriptor td, int tableType)
-	     throws StandardException
+    void validateAutoincrement(DataDictionary dd,
+                               TableDescriptor td,
+                               int tableType) throws StandardException
 	{
 		if (isAutoincrement == false)
 			return;
@@ -528,7 +534,7 @@ public class ColumnDefinitionNode extend
 			break;
 		case Types.BIGINT:
 			autoincrementCheckRange(Long.MIN_VALUE, Long.MAX_VALUE,
-									TypeId.LONGINT_NAME);
+                                    TypeId.BIGINT_NAME);
 			break;
 		default:
 			throw StandardException.newException(SQLState.LANG_AI_INVALID_TYPE,
@@ -609,9 +615,8 @@ public class ColumnDefinitionNode extend
 			// Tell the compiler context to only allow deterministic nodes
 			cc.setReliability( CompilerContext.DEFAULT_RESTRICTION );
 			defaultTree = defaultTree.bindExpression(
-							(FromList) getNodeFactory().getNode(
-								C_NodeTypes.FROM_LIST,
-								getNodeFactory().doJoinOrderOptimization(),
+                            new FromList(
+                                getOptimizerFactory().doJoinOrderOptimization(),
 								getContextManager()), 
 							(SubqueryList) null,
 							(List<AggregateNode>) null);
@@ -686,7 +691,7 @@ public class ColumnDefinitionNode extend
 	 *
 	 */
 
-	public boolean defaultTypeIsValid(TypeId columnType,
+    boolean defaultTypeIsValid(TypeId columnType,
 		DataTypeDescriptor columnDesc, TypeId defaultType,
 		ValueNode defaultNode, String defaultText)
 	throws StandardException
@@ -765,13 +770,13 @@ public class ColumnDefinitionNode extend
 			// value if it's integer.
 				return (defType == StoredFormatIds.INT_TYPE_ID);
 
-			case StoredFormatIds.LONGINT_TYPE_ID:
+            case StoredFormatIds.BIGINT_TYPE_ID:
 			// This is a BIGINT column: we allow smallints, ints,
 			// and big int constants.  Smallint and int literals
 			// are both covered by INT_TYPE; big int literals are
 			// covered by LONG_INT type.
 				return ((defType == StoredFormatIds.INT_TYPE_ID)
-					|| (defType == StoredFormatIds.LONGINT_TYPE_ID));
+                    || (defType == StoredFormatIds.BIGINT_TYPE_ID));
 	
 			case StoredFormatIds.DECIMAL_TYPE_ID:
 				if (defType == StoredFormatIds.DECIMAL_TYPE_ID) {
@@ -790,7 +795,7 @@ public class ColumnDefinitionNode extend
 						((precision - scale) <=
 						(columnDesc.getPrecision() - columnDesc.getScale())));
 				}
-				else if ((defType == StoredFormatIds.LONGINT_TYPE_ID) ||
+                else if ((defType == StoredFormatIds.BIGINT_TYPE_ID) ||
 					(defType == StoredFormatIds.INT_TYPE_ID)) {
 				// only valid if number of digits is within limits of
 				// the decimal column.  We'll check this at insertion time;
@@ -856,7 +861,8 @@ public class ColumnDefinitionNode extend
 	 *
 	 * @param depth		The depth of this node in the tree
 	 */
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnOrdering.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnOrdering.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnOrdering.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnOrdering.java Fri Jun 21 07:47:47 2013
@@ -173,6 +173,7 @@ class ColumnOrdering {
 		return false;
 	}
 
+    @Override
 	public String toString() {
 		String retval = "";
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java Fri Jun 21 07:47:47 2013
@@ -22,28 +22,21 @@
 package	org.apache.derby.impl.sql.compile;
 
 import java.util.List;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-import org.apache.derby.iapi.sql.compile.NodeFactory;
-
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.SQLState;
-
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
-
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.store.access.Qualifier;
-
+import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.util.JBitSet;
 
-
 /**
- * A ColumnReference represents a column in the query tree.  The parser generates a
- * ColumnReference for each column reference.  A column refercence could be a column in
- * a base table, a column in a view (which could expand into a complex
- * expression), or a column in a subquery in the FROM clause.
+ * A ColumnReference represents a column in the query tree.  The parser
+ * generates a ColumnReference for each column reference.  A column reference
+ * could be a column in a base table, a column in a view (which could expand
+ * into a complex expression), or a column in a subquery in the FROM clause.
  *
  */
 
@@ -112,7 +105,7 @@ public class ColumnReference extends Val
 	private java.util.ArrayList<RemapInfo> remaps;
 
 	/**
-	 * Initializer.
+     * Constructor.
 	 * This one is called by the parser where we could
 	 * be dealing with delimited identifiers.
 	 *
@@ -122,33 +115,37 @@ public class ColumnReference extends Val
 	 *					identifier from parser.
 	 * @param tokEndOffset	end position of token for the column name 
 	 *					identifier from parser.
+     * @param cm           The context manager
 	 */
-
-	public void init(Object columnName, 
-					 Object tableName,
-			 		 Object	tokBeginOffset,
-					 Object	tokEndOffset
-					 )
-	{
-		this.columnName = (String) columnName;
-		this.tableName = (TableName) tableName;
-		this.setBeginOffset(((Integer) tokBeginOffset).intValue());
-		this.setEndOffset(((Integer) tokEndOffset).intValue());
+    ColumnReference(String         columnName,
+                    TableName      tableName,
+                    int            tokBeginOffset,
+                    int            tokEndOffset,
+                    ContextManager cm)  {
+        super(cm);
+        setNodeType(C_NodeTypes.COLUMN_REFERENCE);
+        this.columnName = columnName;
+        this.tableName = tableName;
+        this.setBeginOffset(tokBeginOffset);
+        this.setEndOffset(tokEndOffset);
 		tableNumber = -1;
 		remaps = null;
 	}
 
 	/**
-	 * Initializer.
+     * Constructor.
 	 *
 	 * @param columnName	The name of the column being referenced
 	 * @param tableName		The qualification for the column
+     * @param cm           The context manager
 	 */
-
-	public void init(Object columnName, Object tableName)
-	{
-		this.columnName = (String) columnName;
-		this.tableName = (TableName) tableName;
+    ColumnReference(String         columnName,
+                    TableName      tableName,
+                    ContextManager cm) {
+        super(cm);
+        setNodeType(C_NodeTypes.COLUMN_REFERENCE);
+        this.columnName = columnName;
+        this.tableName = tableName;
 		tableNumber = -1;
 		remaps = null;
 	}
@@ -159,7 +156,7 @@ public class ColumnReference extends Val
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
@@ -189,8 +186,8 @@ public class ColumnReference extends Val
 	 *
 	 * @param depth		The depth of this node in the tree
 	 */
-
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -279,7 +276,7 @@ public class ColumnReference extends Val
 	 * column references to the matching aggregate in the 
 	 * user's SELECT.
 	 */
-	public void markGeneratedToReplaceAggregate()
+    void markGeneratedToReplaceAggregate()
 	{
 		replacesAggregate = true;
 	}
@@ -288,7 +285,7 @@ public class ColumnReference extends Val
 	/**
 	 * Mark this node as being generated to replace a window function call.
 	 */
-	public void markGeneratedToReplaceWindowFunctionCall()
+    void markGeneratedToReplaceWindowFunctionCall()
 	{
 		replacesWindowFunctionCall = true;
 	}
@@ -300,7 +297,7 @@ public class ColumnReference extends Val
 	 * @return boolean	Whether or not this node was generated to replace
 	 *					an aggregate in the user's SELECT.
 	 */
-	public boolean getGeneratedToReplaceAggregate()
+    boolean getGeneratedToReplaceAggregate()
 	{
 		return replacesAggregate;
 	}
@@ -313,7 +310,7 @@ public class ColumnReference extends Val
 	 * @return boolean	Whether or not this node was generated to replace
 	 *					a window function call in the user's SELECT.
 	 */
-	public boolean getGeneratedToReplaceWindowFunctionCall()
+    boolean getGeneratedToReplaceWindowFunctionCall()
 	{
 		return replacesWindowFunctionCall;
 	}
@@ -325,14 +322,12 @@ public class ColumnReference extends Val
 	 *
 	 * @exception StandardException			Thrown on error
 	 */
-	public ValueNode getClone()
+    @Override
+    ValueNode getClone()
 		throws StandardException
 	{
-		ColumnReference newCR = (ColumnReference) getNodeFactory().getNode(
-									C_NodeTypes.COLUMN_REFERENCE,
-									columnName,
-									tableName,
-									getContextManager());
+        ColumnReference newCR =
+                new ColumnReference(columnName, tableName, getContextManager());
 
 		newCR.copyFields(this);
 		return newCR;
@@ -345,7 +340,7 @@ public class ColumnReference extends Val
 	 *
 	 * @exception StandardException			Thrown on error
 	 */
-	public void copyFields(ColumnReference oldCR)
+    void copyFields(ColumnReference oldCR)
 		throws StandardException
 	{
 		super.copyFields(oldCR);
@@ -379,9 +374,11 @@ public class ColumnReference extends Val
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-    ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, List aggregates)
-				throws StandardException
+    @Override
+    ValueNode bindExpression(FromList fromList,
+                             SubqueryList subqueryList,
+                             List<AggregateNode> aggregates)
+            throws StandardException
 	{
 		ResultColumn matchingRC;
 
@@ -415,7 +412,7 @@ public class ColumnReference extends Val
 	 * @return	The  column name in the form [[schema.]table.]column
 	 */
 
-	public String getSQLColumnName()
+    String getSQLColumnName()
 	{
 		if (tableName == null)
 			return columnName;
@@ -428,7 +425,7 @@ public class ColumnReference extends Val
 	 *
 	 * @return	The name of this column
 	 */
-
+    @Override
 	public String getColumnName()
 	{
 		return columnName;
@@ -440,7 +437,7 @@ public class ColumnReference extends Val
 	 * @return	int The table number for this ColumnReference
 	 */
 
-	public int getTableNumber()
+    int getTableNumber()
 	{
 		return tableNumber;
 	}
@@ -451,7 +448,7 @@ public class ColumnReference extends Val
 	 * @param tableNumber	The table number this ColumnReference will refer to
 	 */
 
-	public void setTableNumber(int tableNumber)
+    void setTableNumber(int tableNumber)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -470,8 +467,8 @@ public class ColumnReference extends Val
 	 * @return	The user-supplied name of this column.  Null if no user-
 	 * 		supplied name.
 	 */
-
-	public String getTableName()
+    @Override
+    String getTableName()
 	{
 		return ( ( tableName != null) ? tableName.getTableName() : null );
 	}
@@ -487,7 +484,7 @@ public class ColumnReference extends Val
 	 *			Null if not a ColumnReference.
 	 */
 
-	public String getSourceTableName()
+    String getSourceTableName()
 	{
 		return ((source != null) ? source.getTableName() : null);
 	}
@@ -502,7 +499,7 @@ public class ColumnReference extends Val
 	 * @return	The name of the schema for Column's base table. If the column
 	 *		is not in a schema (i.e. is a derived column), it returns NULL.
 	 */
-	public String getSourceSchemaName() throws StandardException
+    String getSourceSchemaName() throws StandardException
 	{
 		return ((source != null) ? source.getSchemaName() : null);
 	}
@@ -513,6 +510,7 @@ public class ColumnReference extends Val
 	 * @return TRUE, if the column is a base column of a table and is 
 	 * writable by cursor.
 	 */
+    @Override
 	public boolean updatableByCursor()
 	{
 		return ((source != null) ? source.updatableByCursor() : false);
@@ -527,7 +525,7 @@ public class ColumnReference extends Val
 		return tableName;
 	}
 
-	public void setTableNameNode(TableName tableName)
+    void setTableNameNode(TableName tableName)
 	{
 		this.tableName = tableName;
 	}
@@ -538,7 +536,7 @@ public class ColumnReference extends Val
 	 * @return	int The column number for this ColumnReference
 	 */
 
-	public int getColumnNumber()
+    int getColumnNumber()
 	{
 		return columnNumber;
 	}
@@ -550,7 +548,7 @@ public class ColumnReference extends Val
 	 * @param colNum The new column number.
 	 */
 
-	public void setColumnNumber(int colNum)
+    void setColumnNumber(int colNum)
 	{
 		this.columnNumber = colNum;
 	}
@@ -561,7 +559,7 @@ public class ColumnReference extends Val
 	 * @return	The source of this columnReference
 	 */
 
-	public ResultColumn getSource()
+    ResultColumn getSource()
 	{
 		return source;
 	}
@@ -572,7 +570,7 @@ public class ColumnReference extends Val
 	 * @param source	The source of this columnReference
 	 */
 
-	public void setSource(ResultColumn source)
+    void setSource(ResultColumn source)
 	{
 		this.source = source;
 	}
@@ -586,33 +584,26 @@ public class ColumnReference extends Val
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ValueNode putAndsOnTop() 
+    @Override
+    ValueNode putAndsOnTop()
 					throws StandardException
 	{
 		BinaryComparisonOperatorNode		equalsNode;
 		BooleanConstantNode	trueNode;
-		NodeFactory		nodeFactory = getNodeFactory();
-		ValueNode		andNode;
 
-        trueNode = (BooleanConstantNode) nodeFactory.getNode(
-										C_NodeTypes.BOOLEAN_CONSTANT_NODE,
-										Boolean.TRUE,
-										getContextManager());
-		equalsNode = (BinaryComparisonOperatorNode) 
-						nodeFactory.getNode(
+        trueNode = new BooleanConstantNode(true, getContextManager());
+        equalsNode = new BinaryRelationalOperatorNode(
 										C_NodeTypes.BINARY_EQUALS_OPERATOR_NODE,
 										this,
 										trueNode,
-										Boolean.FALSE,
+                                        false,
 										getContextManager());
 		/* Set type info for the operator node */
 		equalsNode.bindComparisonOperator();
-		andNode = (ValueNode) nodeFactory.getNode(
-									C_NodeTypes.AND_NODE,
-									equalsNode,
-									trueNode,
-									getContextManager());
-		((AndNode) andNode).postBindFixup();
+
+        AndNode andNode =
+                new AndNode(equalsNode, trueNode, getContextManager());
+       andNode.postBindFixup();
 		return andNode;
 	}
 
@@ -650,7 +641,8 @@ public class ColumnReference extends Val
 	 * @return boolean		Whether or not source.expression is a ColumnReference
 	 *						or a VirtualColumnNode or a ConstantNode.
 	 */
-	public boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly)
+    @Override
+    boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly)
 	{
 		if (SanityManager.DEBUG)
 		SanityManager.ASSERT(tableNumber >= 0,
@@ -673,7 +665,7 @@ public class ColumnReference extends Val
 	 * RESOLVE: Once we start pushing join clauses, we will need to walk the
 	 * ResultColumn/VirtualColumnNode chain for them to remap the references.
 	 */
-	public void remapColumnReferences()
+    void remapColumnReferences()
 	{
 		ValueNode expression = source.getExpression();
 
@@ -739,7 +731,7 @@ public class ColumnReference extends Val
 		}
 	}
 
-	public void unRemapColumnReferences()
+    void unRemapColumnReferences()
 	{
 		if (origSource == null)
 			return;
@@ -750,7 +742,7 @@ public class ColumnReference extends Val
 			// 	"Trying to unremap a ColumnReference that was not remapped.");
 		}
 
-		if ((remaps == null) || (remaps.size() == 0))
+        if ((remaps == null) || (remaps.isEmpty()))
 		{
 			source = origSource;
 			origSource = null;
@@ -768,8 +760,7 @@ public class ColumnReference extends Val
 			columnName = rI.getColumnName();
 			tableNumber = rI.getTableNumber();
 			columnNumber = rI.getColumnNumber();
-			rI = null;
-			if (remaps.size() == 0)
+            if (remaps.isEmpty())
 				remaps = null;
 		}
 	}
@@ -789,7 +780,8 @@ public class ColumnReference extends Val
 	 * Get the ResultColumn that the source points to.  This is useful for
 	 * getting what the source will be after this ColumnReference is remapped.
 	 */
-	public ResultColumn getSourceResultColumn()
+    @Override
+    ResultColumn getSourceResultColumn()
 	{
         /* RESOLVE - If expression is a ColumnReference, then we are hitting
          * the top of a query block (derived table or view.)
@@ -812,7 +804,8 @@ public class ColumnReference extends Val
 	 *
 	 * @exception StandardException			Thrown on error
 	 */
-	public ValueNode remapColumnReferencesToExpressions()
+    @Override
+    ValueNode remapColumnReferencesToExpressions()
 		throws StandardException
 	{
 		ResultColumn	rc;
@@ -884,9 +877,6 @@ public class ColumnReference extends Val
 
                 ResultColumnList rcl = ft.getResultColumns();
 
-                ResultColumn ftRC = null;
-
-
                 // Need to save original (tn,cn) in case we have several
                 // flattenings so we can relocate the correct column many
                 // times. After the first flattening, the (tn,cn) pair points
@@ -900,7 +890,7 @@ public class ColumnReference extends Val
                 // inside a join tree, which can have many columns in the rcl
                 // with the same name, so looking up via column name can give
                 // the wrong column. DERBY-4679.
-                ftRC = rcl.getResultColumn(
+                ResultColumn ftRC = rcl.getResultColumn(
                     tableNumberBeforeFlattening,
                     columnNumberBeforeFlattening,
                     columnName);
@@ -971,13 +961,15 @@ public class ColumnReference extends Val
 	 *
 	 * @return boolean	Whether or not this expression tree is cloneable.
 	 */
-	public boolean isCloneable()
+    @Override
+    boolean isCloneable()
 	{
 		return true;
 	}
 
 	/** @see ValueNode#constantExpression */
-	public boolean constantExpression(PredicateList whereClause)
+    @Override
+    boolean constantExpression(PredicateList whereClause)
 	{
 		return whereClause.constantColumn(this);
 	}
@@ -995,6 +987,7 @@ public class ColumnReference extends Val
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
     void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
 									throws StandardException
 	 {
@@ -1051,8 +1044,8 @@ public class ColumnReference extends Val
 	 * @return	The user-supplied schema name of this column.  Null if no user-
 	 * 		supplied name.
 	 */
-
-	public String getSchemaName()
+    @Override
+    String getSchemaName()
 	{
 		return ( ( tableName != null) ? tableName.getSchemaName() : null );
 	}
@@ -1069,6 +1062,7 @@ public class ColumnReference extends Val
 	 *
 	 * @return	The variant type for the underlying expression.
 	 */
+    @Override
 	protected int getOrderableVariantType()
 	{
 		// ColumnReferences are invariant for the life of the scan
@@ -1090,7 +1084,8 @@ public class ColumnReference extends Val
      * source unless the source is null then it is
      * the type that has been set on this node.
 	 */
-	public DataTypeDescriptor getTypeServices()
+    @Override
+    DataTypeDescriptor getTypeServices()
 	{        
         if (source == null)
             return super.getTypeServices();
@@ -1128,13 +1123,12 @@ public class ColumnReference extends Val
 			return null;
 		}
 
-		ValueNode rcExpr = null;
 		ResultColumn rc = getSource();
 
 		// Walk the ResultColumn->ColumnReference chain until we
 		// find a ResultColumn whose expression is a VirtualColumnNode.
 
-		rcExpr = rc.getExpression();
+        ValueNode rcExpr = rc.getExpression();
 		colNum[0] = getColumnNumber();
 
 		/* We have to make sure we enter this loop if rc is redundant,
@@ -1179,7 +1173,6 @@ public class ColumnReference extends Val
 					 * or function.  Break out of both loops and return
 					 * null since there is no source result set.
 					 */
-					rcExpr = null;
 					break;
 				}
 			}
@@ -1232,7 +1225,7 @@ public class ColumnReference extends Val
 	 * is remapped multiple times.  This allows the CR to be UN-
 	 * remapped multiple times, as well.
 	 */
-	private class RemapInfo
+    private static class RemapInfo
 	{
 		int colNum;
 		int tableNum;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java Fri Jun 21 07:47:47 2013
@@ -22,67 +22,51 @@
 
 package org.apache.derby.impl.sql.compile;
 
+import java.sql.SQLWarning;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
 import org.apache.derby.catalog.UUID;
-
-import org.apache.derby.iapi.sql.conn.LanguageConnectionFactory;
-
-import org.apache.derby.iapi.sql.depend.ProviderList;
+import org.apache.derby.iapi.error.ExceptionSeverity;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.services.compiler.JavaFactory;
+import org.apache.derby.iapi.services.context.ContextImpl;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.services.io.FormatableBitSet;
+import org.apache.derby.iapi.services.loader.ClassFactory;
+import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
-import org.apache.derby.iapi.sql.compile.NodeFactory;
+import org.apache.derby.iapi.sql.compile.OptimizerFactory;
 import org.apache.derby.iapi.sql.compile.Parser;
-
+import org.apache.derby.iapi.sql.compile.TypeCompilerFactory;
 import org.apache.derby.iapi.sql.conn.Authorizer;
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
-
-import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
-import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;
-import org.apache.derby.iapi.sql.dictionary.SequenceDescriptor;
-import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
+import org.apache.derby.iapi.sql.conn.LanguageConnectionFactory;
+import org.apache.derby.iapi.sql.depend.DependencyManager;
+import org.apache.derby.iapi.sql.depend.Dependent;
+import org.apache.derby.iapi.sql.depend.Provider;
+import org.apache.derby.iapi.sql.depend.ProviderList;
 import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;
+import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;
 import org.apache.derby.iapi.sql.dictionary.PermDescriptor;
 import org.apache.derby.iapi.sql.dictionary.PrivilegedSQLObject;
-import org.apache.derby.iapi.sql.dictionary.StatementPermission;
-import org.apache.derby.iapi.sql.dictionary.StatementGenericPermission;
-import org.apache.derby.iapi.sql.dictionary.StatementTablePermission;
-import org.apache.derby.iapi.sql.dictionary.StatementSchemaPermission;
+import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
+import org.apache.derby.iapi.sql.dictionary.SequenceDescriptor;
 import org.apache.derby.iapi.sql.dictionary.StatementColumnPermission;
-import org.apache.derby.iapi.sql.dictionary.StatementRoutinePermission;
+import org.apache.derby.iapi.sql.dictionary.StatementGenericPermission;
+import org.apache.derby.iapi.sql.dictionary.StatementPermission;
 import org.apache.derby.iapi.sql.dictionary.StatementRolePermission;
-
-
-import org.apache.derby.iapi.sql.compile.TypeCompilerFactory;
-
-import org.apache.derby.iapi.sql.depend.Dependent;
-import org.apache.derby.iapi.sql.depend.Provider;
-import org.apache.derby.iapi.sql.depend.DependencyManager;
-import org.apache.derby.iapi.error.ExceptionSeverity;
-import org.apache.derby.iapi.sql.execute.ExecutionContext;
-
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-
-import org.apache.derby.iapi.store.access.StoreCostController;
+import org.apache.derby.iapi.sql.dictionary.StatementRoutinePermission;
+import org.apache.derby.iapi.sql.dictionary.StatementSchemaPermission;
+import org.apache.derby.iapi.sql.dictionary.StatementTablePermission;
+import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.store.access.SortCostController;
-
-import org.apache.derby.iapi.services.context.ContextManager;
-import org.apache.derby.iapi.services.loader.ClassFactory;
-import org.apache.derby.iapi.services.compiler.JavaFactory;
-import org.apache.derby.iapi.services.io.FormatableBitSet;
-
-import org.apache.derby.iapi.error.StandardException;
-
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.iapi.services.context.ContextImpl;
+import org.apache.derby.iapi.store.access.StoreCostController;
 import org.apache.derby.iapi.transaction.TransactionControl;
+import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.util.ReuseFactory;
 
-import java.sql.SQLWarning;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ArrayList;
-
 /**
  *
  * CompilerContextImpl, implementation of CompilerContext.
@@ -170,12 +154,12 @@ public class CompilerContextImpl extends
 	}
 
 	/**
-	  *	Get the NodeFactory for this context
+      * Get the OptimizerFactory for this context
 	  *
-	  *	@return	The NodeFactory for this context.
+      * @return The OptimizerFactory for this context.
 	  */
-	public	NodeFactory	getNodeFactory()
-	{	return lcf.getNodeFactory(); }
+    public  OptimizerFactory    getOptimizerFactory()
+    {   return lcf.getOptimizerFactory(); }
 
 
 	public int getNextColumnNumber()
@@ -563,7 +547,7 @@ public class CompilerContextImpl extends
 	/**
 	 * @see CompilerContext#setParameterList
 	 */
-	public void setParameterList(List parameterList)
+    public void setParameterList(List<ParameterNode> parameterList)
 	{
 		this.parameterList = parameterList;
 
@@ -579,7 +563,7 @@ public class CompilerContextImpl extends
 	/**
 	 * @see CompilerContext#getParameterList
 	 */
-	public List getParameterList()
+    public List<ParameterNode> getParameterList()
 	{
 		return parameterList;
 	}
@@ -603,7 +587,7 @@ public class CompilerContextImpl extends
 	/**
      * Get an array of type descriptors for all the ? parameters.
 	 */
-    DataTypeDescriptor[] getParameterTypes()
+    public DataTypeDescriptor[] getParameterTypes()
 	{
 		return parameterDescriptors;
 	}
@@ -937,7 +921,10 @@ public class CompilerContextImpl extends
 			{
 				UUID objectID = itr.next();
 				
-				list.add( new StatementGenericPermission( objectID, (String) requiredUsagePrivileges.get( objectID ), PermDescriptor.USAGE_PRIV ) );
+                list.add(new StatementGenericPermission(
+                        objectID,
+                        requiredUsagePrivileges.get(objectID),
+                        PermDescriptor.USAGE_PRIV));
 			}
 		}
 		if( requiredTablePrivileges != null)
@@ -1030,7 +1017,7 @@ public class CompilerContextImpl extends
 
 	private SortCostController	sortCostController;
 
-	private List parameterList;
+    private List<ParameterNode> parameterList;
 
 	/* Type descriptors for the ? parameters */
 	private DataTypeDescriptor[]	parameterDescriptors;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConcatenationOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConcatenationOperatorNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConcatenationOperatorNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConcatenationOperatorNode.java Fri Jun 21 07:47:47 2013
@@ -21,25 +21,19 @@
 
 package org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
+import java.sql.Types;
+import java.util.List;
 import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.types.TypeId;
-
-import org.apache.derby.iapi.sql.compile.TypeCompiler;
-import org.apache.derby.iapi.types.StringDataValue;
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-
+import org.apache.derby.iapi.reference.ClassName;
 import org.apache.derby.iapi.reference.Limits;
 import org.apache.derby.iapi.reference.SQLState;
-import org.apache.derby.iapi.reference.ClassName;
-
-import java.sql.Types;
-
-import java.util.List;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
+import org.apache.derby.iapi.sql.compile.TypeCompiler;
+import org.apache.derby.iapi.types.DataTypeDescriptor;
+import org.apache.derby.iapi.types.StringDataValue;
+import org.apache.derby.iapi.types.TypeId;
 
 /**
  * This node represents a concatenation comparison operator
@@ -47,18 +41,28 @@ import java.util.List;
  * varying.
  */
 
-public class ConcatenationOperatorNode extends BinaryOperatorNode {
+class ConcatenationOperatorNode extends BinaryOperatorNode {
 	/**
-	 * Initializer for a ConcatenationOperatorNode
+     * Constructor for a ConcatenationOperatorNode
 	 * 
 	 * @param leftOperand
 	 *            The left operand of the concatenation
 	 * @param rightOperand
 	 *            The right operand of the concatenation
+     * @param cm  The context manager
 	 */
-	public void init(Object leftOperand, Object rightOperand) {
-		super.init(leftOperand, rightOperand, "||", "concatenate",
-				ClassName.ConcatableDataValue, ClassName.ConcatableDataValue);
+    ConcatenationOperatorNode(
+            ValueNode leftOperand,
+            ValueNode rightOperand,
+            ContextManager cm) {
+        super(leftOperand,
+              rightOperand,
+              "||",
+              "concatenate",
+              ClassName.ConcatableDataValue,
+              ClassName.ConcatableDataValue,
+              cm);
+        setNodeType(C_NodeTypes.CONCATENATION_OPERATOR_NODE);
 	}
 
     /**
@@ -68,6 +72,7 @@ public class ConcatenationOperatorNode e
      * @return a constant node representing the result of this concatenation
      * operation, or {@code this} if the result is not known up front
      */
+    @Override
     ValueNode evaluateConstantExpressions() throws StandardException {
         if (leftOperand instanceof CharConstantNode &&
                 rightOperand instanceof CharConstantNode) {
@@ -80,10 +85,8 @@ public class ConcatenationOperatorNode e
                     (StringDataValue) getTypeServices().getNull();
             resultValue.concatenate(leftValue, rightValue, resultValue);
 
-            return (ValueNode) getNodeFactory().getNode(
-                    C_NodeTypes.CHAR_CONSTANT_NODE,
-                    resultValue.getString(),
-                    getContextManager());
+            return new CharConstantNode(
+                resultValue.getString(), getContextManager());
         }
 
         return this;
@@ -96,6 +99,7 @@ public class ConcatenationOperatorNode e
 	 * @exception StandardException
 	 *                thrown on failure
 	 */
+    @Override
     ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)
 			throws StandardException {
 		// deal with binding operands
@@ -220,11 +224,7 @@ public class ConcatenationOperatorNode e
 					Types.VARCHAR, true, tc
 					.getCastToCharWidth(leftOperand							.getTypeServices()));	
 
-			leftOperand = (ValueNode) getNodeFactory().getNode(
-					C_NodeTypes.CAST_NODE,
-					leftOperand,
-					dtd,
-					getContextManager());
+            leftOperand = new CastNode(leftOperand, dtd, getContextManager());
 
 			// DERBY-2910 - Match current schema collation for implicit cast as we do for
 			// explicit casts per SQL Spec 6.12 (10)			
@@ -240,11 +240,7 @@ public class ConcatenationOperatorNode e
 							.getCastToCharWidth(rightOperand
 									.getTypeServices()));
 
-			rightOperand = (ValueNode) getNodeFactory().getNode(
-					C_NodeTypes.CAST_NODE,
-					rightOperand,
-					dtd,
-					getContextManager());
+            rightOperand = new CastNode(rightOperand, dtd, getContextManager());
 			
 			// DERBY-2910 - Match current schema collation for implicit cast as we do for
 			// explicit casts per SQL Spec 6.12 (10)					

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java Fri Jun 21 07:47:47 2013
@@ -22,30 +22,20 @@
 package	org.apache.derby.impl.sql.compile;
 
 import java.util.List;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.ClassName;
+import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.classfile.VMOpcode;
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
-
-
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.services.loader.ClassInspector;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.iapi.error.StandardException;
-
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
+import org.apache.derby.iapi.sql.compile.Visitor;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
-
-import org.apache.derby.iapi.reference.SQLState;
-
 import org.apache.derby.iapi.types.TypeId;
-
-import org.apache.derby.iapi.services.loader.ClassInspector;
-
-import org.apache.derby.iapi.sql.compile.Visitor;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-import org.apache.derby.iapi.reference.ClassName;
-
-
 import org.apache.derby.iapi.util.JBitSet;
-import org.apache.derby.iapi.services.classfile.VMOpcode;
-
 
 /**
  * A ConditionalNode represents an if/then/else operator with a single
@@ -54,7 +44,7 @@ import org.apache.derby.iapi.services.cl
  *
  */
 
-public class ConditionalNode extends ValueNode
+class ConditionalNode extends ValueNode
 {
 	ValueNode		testCondition;
 	ValueNodeList	thenElseList;
@@ -63,17 +53,22 @@ public class ConditionalNode extends Val
 	boolean	thisIsNullIfNode;
 
 	/**
-	 * Initializer for a ConditionalNode
+     * Constructor for a ConditionalNode
 	 *
 	 * @param testCondition		The boolean test condition
 	 * @param thenElseList		ValueNodeList with then and else expressions
+     * @param cm                The context manager
 	 */
-
-	public void init(Object testCondition, Object thenElseList, Object thisIsNullIfNode)
-	{
-		this.testCondition = (ValueNode) testCondition;
-		this.thenElseList = (ValueNodeList) thenElseList;
-		this.thisIsNullIfNode = ((Boolean) thisIsNullIfNode).booleanValue();
+    ConditionalNode(ValueNode testCondition,
+                    ValueNodeList thenElseList,
+                    boolean thisIsNullIfNode,
+                    ContextManager cm)
+	{
+        super(cm);
+        this.testCondition = testCondition;
+        this.thenElseList = thenElseList;
+        this.thisIsNullIfNode = thisIsNullIfNode;
+        setNodeType(C_NodeTypes.CONDITIONAL_NODE);
 	}
 
 	/**
@@ -83,7 +78,7 @@ public class ConditionalNode extends Val
 	 * @param depth		The depth of this node in the tree
 	 */
 
-	public void printSubNodes(int depth)
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -110,10 +105,7 @@ public class ConditionalNode extends Val
 	 * @return 		True if this node is a CastNode, false otherwise.
 	 */
 	private boolean isCastNode(ValueNode node) {
-		if (node.getNodeType() == C_NodeTypes.CAST_NODE)
-			return true;
-		else
-			return false;
+        return node.getNodeType() == C_NodeTypes.CAST_NODE;
 	}
 
 	/**
@@ -154,10 +146,7 @@ public class ConditionalNode extends Val
 	 * @return        True if this node is a CondtionalNode, false otherwise.
 	 */
 	private boolean isConditionalNode(ValueNode node) {
-		if (node.getNodeType() == C_NodeTypes.CONDITIONAL_NODE)
-			return true;
-		else
-			return false;
+        return node.getNodeType() == C_NodeTypes.CONDITIONAL_NODE;
 	}
 
 	/**
@@ -345,8 +334,7 @@ public class ConditionalNode extends Val
 	private QueryTreeNode recastNullNode(ValueNode nodeToCast,
 		DataTypeDescriptor typeToUse) throws StandardException
 	{
-		return (QueryTreeNode) getNodeFactory().getNode(
-					C_NodeTypes.CAST_NODE,
+        return new CastNode(
 					((CastNode)nodeToCast).castOperand,
 					typeToUse,
 					getContextManager());
@@ -365,7 +353,7 @@ public class ConditionalNode extends Val
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
     ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)
 			throws StandardException
 	{
@@ -391,9 +379,8 @@ public class ConditionalNode extends Val
 			 * The untyped NULL should have a data type descriptor
 			 * that allows its value to be nullable.
 			 */
-			QueryTreeNode cast = (QueryTreeNode) getNodeFactory().getNode(
-						C_NodeTypes.CAST_NODE,
-						thenElseList.elementAt(0), 
+            QueryTreeNode cast = new CastNode(
+                        (ValueNode)thenElseList.elementAt(0),
 						bcon.getLeftOperand().getTypeServices().getNullabilityType(true),
 						getContextManager());
 
@@ -513,9 +500,8 @@ public class ConditionalNode extends Val
 		 */
 		if (thenTypeId.typePrecedence() != condTypeId.typePrecedence())
 		{
-			ValueNode cast = (ValueNode) getNodeFactory().getNode(
-								C_NodeTypes.CAST_NODE,
-								thenElseList.elementAt(0), 
+            ValueNode cast = new CastNode(
+                                (ValueNode)thenElseList.elementAt(0),
                                 getTypeServices(),	// cast to dominant type
 								getContextManager());
 			cast = cast.bindExpression(fromList, 
@@ -527,9 +513,8 @@ public class ConditionalNode extends Val
 
 		else if (elseTypeId.typePrecedence() != condTypeId.typePrecedence())
 		{
-			ValueNode cast = (ValueNode) getNodeFactory().getNode(
-								C_NodeTypes.CAST_NODE,
-								thenElseList.elementAt(1), 
+            ValueNode cast = new CastNode(
+                                (ValueNode)thenElseList.elementAt(1),
                                 getTypeServices(),	// cast to dominant type
 								getContextManager());
 			cast = cast.bindExpression(fromList, 
@@ -559,7 +544,8 @@ public class ConditionalNode extends Val
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ValueNode preprocess(int numTables,
+    @Override
+    ValueNode preprocess(int numTables,
 								FromList outerFromList,
 								SubqueryList outerSubqueryList,
 								PredicateList outerPredicateList) 
@@ -599,7 +585,8 @@ public class ConditionalNode extends Val
 	 *						or a VirtualColumnNode.
 	 * @exception StandardException			Thrown on error
 	 */
-	public boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly)
+    @Override
+    boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly)
 		throws StandardException
 	{
 		/* We stop here when only considering simple predicates
@@ -626,7 +613,8 @@ public class ConditionalNode extends Val
 	 *
 	 * @exception StandardException			Thrown on error
 	 */
-	public ValueNode remapColumnReferencesToExpressions()
+    @Override
+    ValueNode remapColumnReferencesToExpressions()
 		throws StandardException
 	{
 		testCondition = testCondition.remapColumnReferencesToExpressions();
@@ -639,14 +627,16 @@ public class ConditionalNode extends Val
 	 *
 	 * @return	Whether or not this expression tree represents a constant expression.
 	 */
-	public boolean isConstantExpression()
+    @Override
+    boolean isConstantExpression()
 	{
 		return (testCondition.isConstantExpression() &&
 			    thenElseList.isConstantExpression());
 	}
 
 	/** @see ValueNode#constantExpression */
-	public boolean constantExpression(PredicateList whereClause)
+    @Override
+    boolean constantExpression(PredicateList whereClause)
 	{
 		return (testCondition.constantExpression(whereClause) &&
 			    thenElseList.constantExpression(whereClause));
@@ -668,6 +658,7 @@ public class ConditionalNode extends Val
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	ValueNode eliminateNots(boolean underNotNode) 
 					throws StandardException
 	{
@@ -696,7 +687,7 @@ public class ConditionalNode extends Val
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
     void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
 									throws StandardException
 	{
@@ -719,6 +710,7 @@ public class ConditionalNode extends Val
 	 *
 	 * @exception StandardException on error
 	 */
+    @Override
 	void acceptChildren(Visitor v)
 		throws StandardException
 	{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstantNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstantNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstantNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstantNode.java Fri Jun 21 07:47:47 2013
@@ -22,19 +22,14 @@
 package	org.apache.derby.impl.sql.compile;
 
 import java.util.List;
-import org.apache.derby.iapi.types.DataValueDescriptor;
-import org.apache.derby.iapi.types.TypeId;
-
 import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
 import org.apache.derby.iapi.services.compiler.LocalField;
-
+import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-
-
 import org.apache.derby.iapi.store.access.Qualifier;
-
+import org.apache.derby.iapi.types.DataValueDescriptor;
+import org.apache.derby.iapi.types.TypeId;
 
 /**
  * ConstantNode holds literal constants as well as nulls.
@@ -65,35 +60,18 @@ abstract class ConstantNode extends Valu
 	** two fields holding the same constant).
 	*/
 
-	/**
-	 * Initializer for non-numeric types
-	 *
-	 * @param typeId	The Type ID of the datatype
-	 * @param nullable	True means the constant is nullable
-	 * @param maximumWidth	The maximum number of bytes in the data value
-	 *
-	 * @exception StandardException
-	 */
-	public void init(
-			Object typeId,
-			Object nullable,
-			Object maximumWidth)
-		throws StandardException
-	{
-        setType((TypeId) typeId,
-                ((Boolean) nullable).booleanValue(),
-                ((Integer) maximumWidth).intValue());
-
-	}
-
-	/**
-	 * Constructor for untyped nodes, which contain little information
-	 *
-	 */
-	ConstantNode()
-	{
-		super();
-	}
+    ConstantNode(
+            TypeId typeId,
+            boolean nullable,
+            int maximumWidth,
+            ContextManager cm) throws StandardException {
+        super(cm);
+        setType(typeId, nullable, maximumWidth);
+    }
+
+    ConstantNode(ContextManager cm) {
+        super(cm);
+    }
 
 	/**
 	 * Set the value in this ConstantNode.
@@ -106,7 +84,7 @@ abstract class ConstantNode extends Valu
 	/**
 	  * Get the value in this ConstantNode
 	  */
-	public DataValueDescriptor	getValue()
+    DataValueDescriptor getValue()
 	{
 		return	value;
 	}
@@ -117,7 +95,7 @@ abstract class ConstantNode extends Valu
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
@@ -136,7 +114,8 @@ abstract class ConstantNode extends Valu
 	 *
 	 * @return boolean	Whether or not this expression tree is cloneable.
 	 */
-	public boolean isCloneable()
+    @Override
+    boolean isCloneable()
 	{
 		return true;
 	}
@@ -147,7 +126,8 @@ abstract class ConstantNode extends Valu
 	 * @return ValueNode	A clone of this node.
 	 *
 	 */
-	public ValueNode getClone()
+    @Override
+    ValueNode getClone()
 	{
 		/* All constants can simply be reused */
 		return this;
@@ -170,9 +150,11 @@ abstract class ConstantNode extends Valu
 	 * doesn't throw this exception, it's subclasses do and hence this method
 	 * signature here needs to have throws StandardException 
 	 */
-    ValueNode bindExpression(
-            FromList fromList, SubqueryList subqueryList, List aggregates)
-	throws StandardException
+    @Override
+    ValueNode bindExpression(FromList fromList,
+                             SubqueryList subqueryList,
+                             List<AggregateNode> aggregates)
+            throws StandardException
 	{
 		/*
 		** This has to be here for binding to work, but it doesn't
@@ -187,13 +169,15 @@ abstract class ConstantNode extends Valu
 	 *
 	 * @return	Whether or not this expression tree represents a constant expression.
 	 */
-	public boolean isConstantExpression()
+    @Override
+    boolean isConstantExpression()
 	{
 		return true;
 	}
 
 	/** @see ValueNode#constantExpression */
-	public boolean constantExpression(PredicateList whereClause)
+    @Override
+    boolean constantExpression(PredicateList whereClause)
 	{
 		return true;
 	}
@@ -210,6 +194,7 @@ abstract class ConstantNode extends Valu
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
     void generateExpression
 	(
         ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
@@ -263,6 +248,7 @@ abstract class ConstantNode extends Valu
 	 *
 	 * @return	The variant type for the underlying expression.
 	 */
+    @Override
 	protected int getOrderableVariantType()
 	{
 		// Constants are constant for the life of the query

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstraintDefinitionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstraintDefinitionNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstraintDefinitionNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstraintDefinitionNode.java Fri Jun 21 07:47:47 2013
@@ -21,21 +21,17 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.sql.StatementType;
-
-import org.apache.derby.iapi.sql.dictionary.DataDictionary;
+import java.util.Properties;
+import org.apache.derby.catalog.UUID;
 import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.sql.depend.ProviderList;
-
+import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.monitor.Monitor;
-
-import org.apache.derby.iapi.util.ReuseFactory;
-
-import org.apache.derby.catalog.UUID;
+import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.services.uuid.UUIDFactory;
-import org.apache.derby.iapi.reference.SQLState;
-import java.util.Properties;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
+import org.apache.derby.iapi.sql.depend.ProviderList;
+import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 
 /**
  * A ConstraintDefintionNode is a class for all nodes that can represent
@@ -43,7 +39,7 @@ import java.util.Properties;
  *
  */
 
-public class ConstraintDefinitionNode extends TableElementNode
+class ConstraintDefinitionNode extends TableElementNode
 {
 	
 	private TableName constraintName;
@@ -59,75 +55,47 @@ public class ConstraintDefinitionNode ex
 	String			 constraintText;
 	ValueNode		 checkCondition;
 	private int				 behavior;
-    private int verifyType = DataDictionary.DROP_CONSTRAINT; // By default do not check the constraint type
+    private int verifyType;
 
-	public void init(
-					Object constraintName,
-					Object constraintType,
-					Object rcl,
-					Object properties,
-					Object checkCondition,
-					Object constraintText,
-					Object behavior)
+    ConstraintDefinitionNode(
+                    TableName constraintName,
+                    int constraintType,
+                    ResultColumnList rcl,
+                    Properties properties,
+                    ValueNode checkCondition,
+                    String constraintText,
+                    int behavior,
+                    int verifyType,
+                    ContextManager cm)
 	{
-		this.constraintName = (TableName) constraintName;
-
 		/* We need to pass null as name to TableElementNode's constructor 
 		 * since constraintName may be null.
 		 */
-		super.init(null);
+        super(null, cm);
+        setNodeType(C_NodeTypes.CONSTRAINT_DEFINITION_NODE);
+
+        this.constraintName = constraintName;
+
 		if (this.constraintName != null)
 		{
 			this.name = this.constraintName.getTableName();
 		}
-		this.constraintType = ((Integer) constraintType).intValue();
-		this.properties = (Properties) properties;
-		this.columnList = (ResultColumnList) rcl;
-		this.checkCondition = (ValueNode) checkCondition;
-		this.constraintText = (String) constraintText;
-		this.behavior = ((Integer) behavior).intValue();
-	}
-
-	public void init(
-					Object constraintName,
-					Object constraintType,
-					Object rcl,
-					Object properties,
-					Object checkCondition,
-					Object constraintText)
-	{
-		init(
-					constraintName,
-					constraintType,
-					rcl,
-					properties, 
-					checkCondition,
-					constraintText,
-					ReuseFactory.getInteger(StatementType.DROP_DEFAULT)
-					);
-	}
-
-	public void init(
-					Object constraintName,
-					Object constraintType,
-					Object rcl,
-					Object properties,
-					Object checkCondition,
-					Object constraintText,
-					Object behavior,
-                    Object verifyType)
-	{
-        init( constraintName, constraintType, rcl, properties, checkCondition, constraintText, behavior);
-        this.verifyType = ((Integer) verifyType).intValue();
-    }
-    
+        this.constraintType = constraintType;
+        this.properties = properties;
+        this.columnList = rcl;
+        this.checkCondition = checkCondition;
+        this.constraintText = constraintText;
+        this.behavior = behavior;
+        this.verifyType = verifyType;
+	}
+
 	/**
 	 * Convert this object to a String.  See comments in QueryTreeNode.java
 	 * for how this should be done for tree printing.
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
@@ -258,7 +226,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @return	The auxiliary provider list.
 	 */
-	public ProviderList getAuxiliaryProviderList()
+    ProviderList getAuxiliaryProviderList()
 	{
 		return apl;
 	}
@@ -268,6 +236,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @return boolean	Whether or not this is a primary key constraint
 	 */
+    @Override
 	boolean hasPrimaryKeyConstraint()
 	{
 		return constraintType == DataDictionary.PRIMARYKEY_CONSTRAINT;
@@ -278,6 +247,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @return boolean	Whether or not this is a unique key constraint
 	 */
+    @Override
 	boolean hasUniqueKeyConstraint()
 	{
 		return constraintType == DataDictionary.UNIQUE_CONSTRAINT;
@@ -288,6 +258,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @return boolean	Whether or not this is a unique key constraint
 	 */
+    @Override
 	boolean hasForeignKeyConstraint()
 	{
 		return constraintType == DataDictionary.FOREIGNKEY_CONSTRAINT;
@@ -298,6 +269,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @return boolean	Whether or not this element has a check constraint
 	 */
+    @Override
 	boolean hasCheckConstraint()
 	{
 		return constraintType == DataDictionary.CHECK_CONSTRAINT;
@@ -308,6 +280,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @return boolean	Whether or not this element has a constraint on it
 	 */
+    @Override
 	boolean hasConstraint()
 	{
 		return true;
@@ -363,7 +336,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @param properties	The optional Properties for this constraint.
 	 */
-	public void setProperties(Properties properties)
+    void setProperties(Properties properties)
 	{
 		this.properties = properties;
 	}
@@ -374,7 +347,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @return The optional properties for the backing index to this constraint
 	 */
-	public Properties getProperties()
+    Properties getProperties()
 	{
 		return properties;
 	}
@@ -385,7 +358,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @return true/false
 	 */
-	public boolean isReferenced()
+    boolean isReferenced()
 	{
 		return false;
 	}
@@ -396,7 +369,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @return the number
 	 */
-	public int getReferenceCount()
+    int getReferenceCount()
 	{
 		return 0;
 	}
@@ -405,7 +378,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @return true/false
 	 */
-	public boolean isEnabled()
+    boolean isEnabled()
 	{
 		return true;
 	}
@@ -415,7 +388,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @return ResultColumnList The column list from this table constraint.
 	 */
-	public ResultColumnList getColumnList()
+    ResultColumnList getColumnList()
 	{
 		return columnList;
 	}
@@ -426,7 +399,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @param columnList	The new columnList.
 	 */
-	public void setColumnList(ResultColumnList columnList)
+    void setColumnList(ResultColumnList columnList)
 	{
 		this.columnList = columnList;
 	}
@@ -436,7 +409,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @return The check condition from this node.
 	 */
-	public ValueNode getCheckCondition()
+    ValueNode getCheckCondition()
 	{
 		return checkCondition;
 	}
@@ -446,7 +419,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @param checkCondition	The check condition
 	 */
-	public void setCheckCondition(ValueNode checkCondition)
+    void setCheckCondition(ValueNode checkCondition)
 	{
 		this.checkCondition = checkCondition;
 	}
@@ -456,7 +429,7 @@ public class ConstraintDefinitionNode ex
 	 *
 	 * @return The constraint text.
 	 */
-	public String getConstraintText()
+    String getConstraintText()
 	{
 		return constraintText;
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CostEstimateImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CostEstimateImpl.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CostEstimateImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CostEstimateImpl.java Fri Jun 21 07:47:47 2013
@@ -21,21 +21,19 @@
 
 package org.apache.derby.impl.sql.compile;
 
+import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.compile.CostEstimate;
-
 import org.apache.derby.iapi.store.access.StoreCostResult;
 
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
-public class CostEstimateImpl implements CostEstimate {
-	public double	cost;
-	public double	rowCount;
-	public double	singleScanRowCount;
+class CostEstimateImpl implements CostEstimate {
+    double  cost;
+    double  rowCount;
+    double  singleScanRowCount;
 
-	public CostEstimateImpl() {
+    CostEstimateImpl() {
 	}
 
-	public CostEstimateImpl(double theCost,
+    CostEstimateImpl(double theCost,
 							double theRowCount,
 							double theSingleScanRowCount) {
 		if (SanityManager.DEBUG)
@@ -313,7 +311,7 @@ public class CostEstimateImpl implements
 		singleScanRowCount = (double) count;
 	}
 
-	public CostEstimateImpl setState(double theCost,
+    CostEstimateImpl setState(double theCost,
 										double theRowCount,
 										CostEstimateImpl retval) {
 		if (retval == null) {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CountAggregateDefinition.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CountAggregateDefinition.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CountAggregateDefinition.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CountAggregateDefinition.java Fri Jun 21 07:47:47 2013
@@ -21,28 +21,21 @@
 
 package org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-
-import org.apache.derby.impl.sql.execute.CountAggregator;
-
-import org.apache.derby.catalog.TypeDescriptor;
-
 import org.apache.derby.iapi.reference.ClassName;
-
+import org.apache.derby.iapi.types.DataTypeDescriptor;
 
 /**
- * Defintion for the COUNT()/COUNT(*) aggregates.
+ * Definition for the COUNT()/COUNT(*) aggregates.
  *
  */
-public class CountAggregateDefinition 
+class CountAggregateDefinition
 		implements AggregateDefinition 
 {
 	/**
 	 * Niladic constructor.  Does nothing.  For ease
 	 * Of use, only.
 	 */
-	public CountAggregateDefinition() { super(); }
+    CountAggregateDefinition() { super(); }
 
 	/**
 	 * Determines the result datatype. We can run

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java Fri Jun 21 07:47:47 2013
@@ -31,7 +31,9 @@ import org.apache.derby.catalog.types.Sy
 import org.apache.derby.catalog.types.UDTAliasInfo;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
@@ -44,7 +46,7 @@ import org.apache.derby.iapi.types.TypeI
  *
  */
 
-public class CreateAliasNode extends DDLStatementNode
+class CreateAliasNode extends DDLStatementNode
 {
     // indexes into routineElements
     public static final int PARAMETER_ARRAY = 0;
@@ -118,27 +120,28 @@ public class CreateAliasNode extends DDL
 
 
 	/**
-	 * Initializer for a CreateAliasNode
+     * Constructor
 	 *
 	 * @param aliasName				The name of the alias
-	 * @param targetObject			Target name
+     * @param targetObject          Target name string or, if
+     *        aliasType == ALIAS_TYPE_SYNONYM_AS_CHAR, a TableName
 	 * @param methodName		    The method name
-	 * @param aliasType				The alias type
-     *
-	 * @exception StandardException		Thrown on error
+     * @param aliasSpecificInfo     An array of objects, see code for
+     *                              interpretation
+     * @param cm                    The context manager
+     * @exception StandardException Thrown on error
 	 */
-	public void init(
-						Object aliasName,
+    CreateAliasNode(    TableName aliasName,
 						Object targetObject,
-						Object methodName,
+                        String methodName,
 						Object aliasSpecificInfo,
-                        Object aliasType)
+                        char aliasType,
+                        ContextManager cm)
 		throws StandardException
 	{		
-		TableName qn = (TableName) aliasName;
-		this.aliasType = ((Character) aliasType).charValue();
-
-		initAndCheck(qn);
+        super(aliasName, cm);
+        setNodeType(C_NodeTypes.CREATE_ALIAS_NODE);
+        this.aliasType = aliasType;
 
 		switch (this.aliasType)
 		{
@@ -173,7 +176,7 @@ public class CreateAliasNode extends DDL
 			case AliasInfo.ALIAS_TYPE_FUNCTION_AS_CHAR:
 			{
 				this.javaClassName = (String) targetObject;
-				this.methodName = (String) methodName;
+                this.methodName = methodName;
 
 				//routineElements contains the description of the procedure.
 				// 
@@ -324,7 +327,7 @@ public class CreateAliasNode extends DDL
 		}
 	}
 
-	public String statementToString()
+    String statementToString()
 	{
 		switch (this.aliasType)
 		{
@@ -353,7 +356,7 @@ public class CreateAliasNode extends DDL
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
 	public void bindStatement() throws StandardException
 	{
 		//Are we dealing with user defined function or procedure?
@@ -473,15 +476,15 @@ public class CreateAliasNode extends DDL
         // A user-defined aggregate cannot have the name of a builtin function which takes 1 argument.
         //
         SchemaDescriptor    sysfun = getSchemaDescriptor( "SYSFUN", true );
-        List                        systemFunctions = getDataDictionary().getRoutineList
-            (
-             sysfun.getUUID().toString(), unqualifiedName,
-             AliasInfo.ALIAS_NAME_SPACE_FUNCTION_AS_CHAR
-             );
+        List<AliasDescriptor> systemFunctions =
+            getDataDictionary().getRoutineList(
+                sysfun.getUUID().toString(),
+                unqualifiedName,
+                AliasInfo.ALIAS_NAME_SPACE_FUNCTION_AS_CHAR);
 
         for ( int i = 0; i < systemFunctions.size(); i++ )
         {
-			AliasDescriptor function = (AliasDescriptor) systemFunctions.get(i);
+            AliasDescriptor function = systemFunctions.get(i);
 
 			RoutineAliasInfo routineInfo = (RoutineAliasInfo) function.getAliasInfo();
 			int parameterCount = routineInfo.getParameterCount();
@@ -539,7 +542,8 @@ public class CreateAliasNode extends DDL
 	 *
 	 * @exception StandardException		Thrown on failure
 	 */
-	public ConstantAction	makeConstantAction() throws StandardException
+    @Override
+    public ConstantAction makeConstantAction() throws StandardException
 	{
 		String schemaName = getSchemaDescriptor().getSchemaName();
 



Mime
View raw message