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 [10/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/sq...
Date Fri, 21 Jun 2013 07:47:52 GMT
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IsNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IsNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IsNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IsNode.java Fri Jun 21 07:47:47 2013
@@ -23,34 +23,34 @@ package	org.apache.derby.impl.sql.compil
 
 import java.util.List;
 import org.apache.derby.iapi.error.StandardException;
-
-
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
-
 import org.apache.derby.iapi.reference.ClassName;
 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.sql.compile.C_NodeTypes;
 
-
-public class IsNode extends BinaryLogicalOperatorNode
+class IsNode extends BinaryLogicalOperatorNode
 {
 	private boolean		notMe;	// set to true if we're to negate the sense of this node
 
 	/**
-	 * Initializer for an IsNode
+     * Constructor for an IsNode
 	 *
 	 * @param leftOperand	The left operand of the IS
 	 * @param rightOperand	The right operand of the IS
 	 * @param notMe			Whether to reverse the sense of this node.
+     * @param cm            The context manager
 	 */
 
-	public void init(
-							Object leftOperand,
-							Object rightOperand,
-							Object notMe )
+    IsNode(ValueNode leftOperand,
+           ValueNode rightOperand,
+           boolean notMe,
+           ContextManager cm)
 	{
 		// the false for shortCir
-		super.init(leftOperand, rightOperand, "is" );
-		this.notMe = ((Boolean) notMe).booleanValue();
+        super(leftOperand, rightOperand, "is", cm );
+        setNodeType(C_NodeTypes.IS_NODE);
+        this.notMe = notMe;
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IsNullNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IsNullNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IsNullNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IsNullNode.java Fri Jun 21 07:47:47 2013
@@ -21,31 +21,19 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import java.sql.Types;
+import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.ClassName;
-
 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.error.StandardException;
-
 import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.Optimizable;
-
-import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
-
 import org.apache.derby.iapi.store.access.ScanController;
-
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.DataValueDescriptor;
-import org.apache.derby.iapi.types.DataValueFactory;
-import org.apache.derby.iapi.types.StringDataValue;
-import org.apache.derby.iapi.types.TypeId;
-
 import org.apache.derby.iapi.types.Orderable;
-
-import org.apache.derby.impl.sql.compile.ExpressionClassBuilder;
-
-import java.sql.Types;
+import org.apache.derby.iapi.types.TypeId;
 
 /**
  * This node represents either a unary 
@@ -56,19 +44,29 @@ import java.sql.Types;
 public final class IsNullNode extends UnaryComparisonOperatorNode
 						implements RelationalOperator
 {
-
+    enum Sign {IS_NULL, IS_NOT_NULL};
 	private DataValueDescriptor nullValue;
 
-	public void setNodeType(int nodeType)
+    IsNullNode(ValueNode operand, Sign t, ContextManager cm)
+            throws StandardException {
+        super(operand, cm);
+        setNodeType(
+            t == Sign.IS_NOT_NULL ?
+                C_NodeTypes.IS_NOT_NULL_NODE :
+                C_NodeTypes.IS_NULL_NODE);
+    }
+
+    @Override
+    void setNodeType(int nodeType)
 	{
-		String operator;
-		String methodName;
+        String op;
+        String methodNam;
 
 		if (nodeType == C_NodeTypes.IS_NULL_NODE)
 		{
 			/* By convention, the method name for the is null operator is "isNull" */
-			operator = "is null";
-			methodName = "isNullOp";
+            op = "is null";
+            methodNam = "isNullOp";
 		}
 		else
 		{
@@ -83,11 +81,11 @@ public final class IsNullNode extends Un
 			/* By convention, the method name for the is not null operator is 
 			 * "isNotNull" 
 			 */
-			operator = "is not null";
-			methodName = "isNotNull";
+            op = "is not null";
+            methodNam = "isNotNull";
 		}
-		setOperator(operator);
-		setMethodName(methodName);
+        setOperator(op);
+        setMethodName(methodNam);
 		super.setNodeType(nodeType);
 	}
 
@@ -135,7 +133,7 @@ public final class IsNullNode extends Un
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
 	void bindParameter()
 			throws StandardException
 	{
@@ -212,10 +210,10 @@ public final class IsNullNode extends Un
 	/** @see RelationalOperator#getOperator */
 	public int getOperator()
 	{
-		int operator;
+        int op;
 		if (isNullNode())
 		{
-			operator = IS_NULL_RELOP;
+            op = IS_NULL_RELOP;
 		}
 		else
 		{
@@ -227,10 +225,10 @@ public final class IsNullNode extends Un
 						"Unexpected nodeType = " + getNodeType());
 				}
 			}
-			operator = IS_NOT_NULL_RELOP;
+            op = IS_NOT_NULL_RELOP;
 		}
 
-		return operator;
+        return op;
 	}
 
 	/** @see RelationalOperator#compareWithKnownConstant */
@@ -290,21 +288,24 @@ public final class IsNullNode extends Un
 	public RelationalOperator getTransitiveSearchClause(ColumnReference otherCR)
 		throws StandardException
 	{
-		return (RelationalOperator) getNodeFactory().getNode(
-									getNodeType(),
-									otherCR,
-									getContextManager());
+        return new IsNullNode(otherCR,
+                getNodeType() == C_NodeTypes.IS_NULL_NODE ?
+                Sign.IS_NULL :
+                Sign.IS_NOT_NULL,
+                getContextManager());
 	}
 
 	/**
 	 * null operators are defined on DataValueDescriptor.
 	 * Overrides method in UnaryOperatorNode for code generation purposes.
 	 */
-	public String getReceiverInterfaceName() {
+    @Override
+    String getReceiverInterfaceName() {
 	    return ClassName.DataValueDescriptor;
 	}
 
 	/** IS NULL is like =, so should have the same selectivity */
+    @Override
 	public double selectivity(Optimizable optTable) 
 	{
 		if (isNullNode())
@@ -337,13 +338,15 @@ public final class IsNullNode extends Un
 	}
 	
 	/** @see ValueNode#isRelationalOperator */
-	public boolean isRelationalOperator()
+    @Override
+    boolean isRelationalOperator()
 	{
 		return true;
 	}
 
 	/** @see ValueNode#optimizableEqualityNode */
-	public boolean optimizableEqualityNode(Optimizable optTable, 
+    @Override
+    boolean optimizableEqualityNode(Optimizable optTable,
 										   int columnNumber, 
 										   boolean isNullOkay)
 	{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java Fri Jun 21 07:47:47 2013
@@ -21,44 +21,42 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import java.lang.reflect.Modifier;
+import java.util.List;
 import org.apache.derby.catalog.TypeDescriptor;
-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.sql.compile.TypeCompiler;
+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.compiler.LocalField;
-
-import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.sql.compile.Visitor;
-
+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 java.lang.reflect.Modifier;
-import java.util.List;
-
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
+import org.apache.derby.iapi.sql.compile.TypeCompiler;
+import org.apache.derby.iapi.sql.compile.Visitor;
+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.util.JBitSet;
 
-
 /**
  * This node type converts a value from the Java domain to the SQL domain.
  */
 
-public class JavaToSQLValueNode extends ValueNode
+class JavaToSQLValueNode extends ValueNode
 {
 	JavaValueNode	javaNode;
 
 	/**
-	 * Initializer for a JavaToSQLValueNode
+     * Constructor for a JavaToSQLValueNode
 	 *
 	 * @param value		The Java value to convert to the SQL domain
+     * @param cm        The context manager
 	 */
-	public void init(Object value)
+    JavaToSQLValueNode(JavaValueNode value, ContextManager cm)
 	{
-		this.javaNode = (JavaValueNode) value;
+        super(cm);
+        setNodeType(C_NodeTypes.JAVA_TO_SQL_VALUE_NODE);
+        this.javaNode = value;
 	}
 
 	/**
@@ -76,7 +74,8 @@ public class JavaToSQLValueNode extends 
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ValueNode preprocess(int numTables,
+    @Override
+    ValueNode preprocess(int numTables,
 								FromList outerFromList,
 								SubqueryList outerSubqueryList,
 								PredicateList outerPredicateList) 
@@ -98,7 +97,7 @@ public class JavaToSQLValueNode extends 
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
     void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
 									throws StandardException
 	{
@@ -182,8 +181,8 @@ public class JavaToSQLValueNode extends 
 	 *
 	 * @param depth		The depth of this node in the tree
 	 */
-
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -220,6 +219,7 @@ public class JavaToSQLValueNode extends 
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
     ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)
 			throws StandardException
 	{
@@ -275,7 +275,8 @@ public class JavaToSQLValueNode extends 
 	 *
 	 * @exception StandardException			Thrown on error
 	 */
-	public ValueNode remapColumnReferencesToExpressions()
+    @Override
+    ValueNode remapColumnReferencesToExpressions()
 		throws StandardException
 	{
 		javaNode = javaNode.remapColumnReferencesToExpressions();
@@ -307,7 +308,8 @@ public class JavaToSQLValueNode extends 
 	 *
 	 * @exception StandardException			Thrown on error
 	 */
-	public boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly)
+    @Override
+    boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly)
 		throws StandardException
 	{
 		return javaNode.categorize(referencedTabs, simplePredsOnly);
@@ -326,6 +328,7 @@ public class JavaToSQLValueNode extends 
 	 * @return	The variant type for the underlying expression.
 	 * @exception StandardException	thrown on error
 	 */
+    @Override
 	protected int getOrderableVariantType() throws StandardException
 	{
 		return javaNode.getOrderableVariantType();
@@ -338,6 +341,7 @@ public class JavaToSQLValueNode extends 
 	 *
 	 * @exception StandardException on error
 	 */
+    @Override
 	void acceptChildren(Visitor v)
 		throws StandardException
 	{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaValueNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaValueNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaValueNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaValueNode.java Fri Jun 21 07:47:47 2013
@@ -21,36 +21,22 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.sql.compile.CompilerContext;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
-
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-
-
-import org.apache.derby.iapi.types.TypeId;
-
+import java.lang.reflect.Modifier;
+import java.util.List;
 import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.types.JSQLType;
-
+import org.apache.derby.iapi.reference.SQLState;
 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.loader.ClassInspector;
-
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.compile.CompilerContext;
 import org.apache.derby.iapi.store.access.Qualifier;
-
+import org.apache.derby.iapi.types.DataTypeDescriptor;
+import org.apache.derby.iapi.types.JSQLType;
+import org.apache.derby.iapi.types.TypeId;
 import org.apache.derby.iapi.util.JBitSet;
 
-import org.apache.derby.iapi.reference.SQLState;
-
-import java.lang.reflect.Modifier;
-
-import java.util.List;
-
 /**
  * This abstract node class represents a data value in the Java domain.
  */
@@ -71,6 +57,10 @@ abstract class JavaValueNode extends Que
         // * Collation type of schema where method is defined. 
 	private int collationType;
 
+    JavaValueNode(ContextManager cm) {
+        super(cm);
+    }
+
     /**
      * Get the resolved data type of this node. May be overridden by descendants.
      */
@@ -249,6 +239,7 @@ abstract class JavaValueNode extends Que
 	 * @exception StandardException		Thrown on error
 	 */
 
+    @Override
     final   void generate(ActivationClassBuilder acb, MethodBuilder mb)
 									throws StandardException
 	{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java Fri Jun 21 07:47:47 2013
@@ -21,42 +21,32 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+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.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.CostEstimate;
 import org.apache.derby.iapi.sql.compile.Optimizable;
 import org.apache.derby.iapi.sql.compile.OptimizablePredicate;
 import org.apache.derby.iapi.sql.compile.OptimizablePredicateList;
 import org.apache.derby.iapi.sql.compile.Optimizer;
-import org.apache.derby.iapi.sql.compile.Visitor;
-import org.apache.derby.iapi.sql.compile.CostEstimate;
 import org.apache.derby.iapi.sql.compile.RowOrdering;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-
-import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
+import org.apache.derby.iapi.sql.compile.Visitor;
 import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
-
-import org.apache.derby.iapi.types.TypeId;
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-
-import org.apache.derby.iapi.reference.SQLState;
-import org.apache.derby.iapi.reference.ClassName;
-
+import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.store.access.TransactionController;
-
+import org.apache.derby.iapi.types.DataTypeDescriptor;
+import org.apache.derby.iapi.types.TypeId;
 import org.apache.derby.iapi.util.JBitSet;
 import org.apache.derby.iapi.util.PropertyUtil;
-import org.apache.derby.iapi.services.classfile.VMOpcode;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
 
 /**
  * A JoinNode represents a join result set for either of the basic DML
@@ -68,15 +58,15 @@ import java.util.Properties;
  *
  */
 
-public class JoinNode extends TableOperatorNode
+class JoinNode extends TableOperatorNode
 {
 	/* Join semantics */
-	public static final int INNERJOIN = 1;
-	public static final int CROSSJOIN = 2;
-	public static final int LEFTOUTERJOIN = 3;
-	public static final int RIGHTOUTERJOIN = 4;
-	public static final int FULLOUTERJOIN = 5;
-	public static final int UNIONJOIN = 6;
+    static final int INNERJOIN = 1;
+    static final int CROSSJOIN = 2;
+    static final int LEFTOUTERJOIN = 3;
+    static final int RIGHTOUTERJOIN = 4;
+    static final int FULLOUTERJOIN = 5;
+    static final int UNIONJOIN = 6;
 
     /** If this flag is true, this node represents a natural join. */
     private boolean naturalJoin;
@@ -98,7 +88,7 @@ public class JoinNode extends TableOpera
 
 
 	/**
-	 * Initializer for a JoinNode.
+     * Constructor for a JoinNode.
 	 *
 	 * @param leftResult	The ResultSetNode on the left side of this join
 	 * @param rightResult	The ResultSetNode on the right side of this join
@@ -107,30 +97,31 @@ public class JoinNode extends TableOpera
 	 * @param selectList	The result column list for the join
 	 * @param tableProperties	Properties list associated with the table
 	 * @param joinOrderStrategyProperties	User provided optimizer overrides
+     * @param cm            The context manager
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void init(
-					Object leftResult,
-					Object rightResult,
-					Object onClause,
-					Object usingClause,
-					Object selectList,
-					Object tableProperties,
-					Object joinOrderStrategyProperties)
-			throws StandardException
-	{
-		super.init(leftResult, rightResult, tableProperties);
-		resultColumns = (ResultColumnList) selectList;
-		joinClause = (ValueNode) onClause;
-		joinClauseNormalized = false;
-		this.usingClause = (ResultColumnList) usingClause;
-		this.joinOrderStrategyProperties = (Properties)joinOrderStrategyProperties;
+    JoinNode(ResultSetNode    leftResult,
+             ResultSetNode    rightResult,
+             ValueNode        onClause,
+             ResultColumnList usingClause,
+             ResultColumnList selectList,
+             Properties       tableProperties,
+             Properties       joinOrderStrategyProperties,
+             ContextManager   cm) throws StandardException {
+
+        super(leftResult, rightResult, tableProperties, cm);
+        setNodeType(C_NodeTypes.JOIN_NODE);
+        this.resultColumns = selectList;
+        this.joinClause = onClause;
+        this.joinClauseNormalized = false;
+        this.usingClause = usingClause;
+        this.joinOrderStrategyProperties = joinOrderStrategyProperties;
 
 		/* JoinNodes can be generated in the parser or at the end of optimization.
 		 * Those generated in the parser do not have resultColumns yet.
 		 */
-		if (resultColumns != null)
+        if (this.resultColumns != null)
 		{
 			/* A longer term assertion */
 			if (SanityManager.DEBUG)
@@ -145,13 +136,14 @@ public class JoinNode extends TableOpera
 			/* Build the referenced table map (left || right) */
 			if (leftResultSet.getReferencedTableMap() != null)
 			{
-				referencedTableMap = (JBitSet) leftResultSet.getReferencedTableMap().clone();
-				referencedTableMap.or((JBitSet) rightResultSet.getReferencedTableMap());
+                this.referencedTableMap =
+                        (JBitSet) leftResultSet.getReferencedTableMap().clone();
+                this.referencedTableMap.or(
+                        rightResultSet.getReferencedTableMap());
 			}
 		}
-		joinPredicates = (PredicateList) getNodeFactory().getNode(
-											C_NodeTypes.PREDICATE_LIST,
-											getContextManager());
+
+        this.joinPredicates = new PredicateList(cm);
 	}
 
 	/*
@@ -163,6 +155,7 @@ public class JoinNode extends TableOpera
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public CostEstimate optimizeIt(
 							Optimizer optimizer,
 							OptimizablePredicateList predList,
@@ -293,7 +286,7 @@ public class JoinNode extends TableOpera
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
 	public boolean pushOptPredicate(OptimizablePredicate optimizablePredicate)
 			throws StandardException
 	{
@@ -323,6 +316,7 @@ public class JoinNode extends TableOpera
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public Optimizable modifyAccessPath(JBitSet outerTables) throws StandardException
 	{
 		super.modifyAccessPath(outerTables);
@@ -373,7 +367,8 @@ public class JoinNode extends TableOpera
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultColumnList getAllResultColumns(TableName allTableName)
+    @Override
+    ResultColumnList getAllResultColumns(TableName allTableName)
 			throws StandardException
 	{
 		/* We need special processing when there is a USING clause.
@@ -508,10 +503,8 @@ public class JoinNode extends TableOpera
 			}
 
 			// Return a spliced copy of the 2 lists
-			ResultColumnList tempList =
-								(ResultColumnList) getNodeFactory().getNode(
-												C_NodeTypes.RESULT_COLUMN_LIST,
-												getContextManager());
+            ResultColumnList
+                    tempList = new ResultColumnList((getContextManager()));
 			tempList.nondestructiveAppend(leftRCL);
 			tempList.nondestructiveAppend(rightRCL);
 			return tempList;
@@ -531,8 +524,9 @@ public class JoinNode extends TableOpera
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public ResultColumn getMatchingColumn(ColumnReference columnReference) throws StandardException
+    @Override
+    ResultColumn getMatchingColumn(ColumnReference columnReference)
+            throws StandardException
 	{
 		/* Get the logical left and right sides of the join.
 		 * (For RIGHT OUTER JOIN, the left is the right
@@ -540,12 +534,11 @@ public class JoinNode extends TableOpera
 		 */
 		ResultSetNode	logicalLeftRS = getLogicalLeftResultSet();
 		ResultSetNode	logicalRightRS = getLogicalRightResultSet();
-		ResultColumn	leftRC = null;
 		ResultColumn	resultColumn = null;
 		ResultColumn	rightRC = null;
 		ResultColumn	usingRC = null;
 
-		leftRC = logicalLeftRS.getMatchingColumn(columnReference);
+        ResultColumn leftRC = logicalLeftRS.getMatchingColumn(columnReference);
 
 		if (leftRC != null)
 		{
@@ -633,6 +626,7 @@ public class JoinNode extends TableOpera
     /**
      * Bind the expressions under this node.
      */
+    @Override
     public void bindExpressions(FromList fromListParam)
             throws StandardException
     {
@@ -656,7 +650,8 @@ public class JoinNode extends TableOpera
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void bindResultColumns(FromList fromListParam)
+    @Override
+    void bindResultColumns(FromList fromListParam)
 					throws StandardException
 	{
 		super.bindResultColumns(fromListParam);
@@ -702,7 +697,7 @@ public class JoinNode extends TableOpera
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
     void bindResultColumns(TableDescriptor targetTableDescriptor,
             FromVTI targetVTI, ResultColumnList targetColumnList,
             DMLStatementNode statement, FromList fromListParam)
@@ -802,13 +797,13 @@ public class JoinNode extends TableOpera
 	private void deferredBindExpressions(FromList fromListParam)
 				throws StandardException
 	{
+        ContextManager cm = getContextManager();
+        CompilerContext cc = getCompilerContext();
+
 		/* Bind the expressions in the join clause */
-		subqueryList = (SubqueryList) getNodeFactory().getNode(
-											C_NodeTypes.SUBQUERY_LIST,
-											getContextManager());
+        subqueryList = new SubqueryList(cm);
         aggregates = new ArrayList<AggregateNode>();
 
-        CompilerContext cc = getCompilerContext();
         
 		/* ON clause */
 		if (joinClause != null)
@@ -818,10 +813,9 @@ public class JoinNode extends TableOpera
 			 * are limited to columns from the 2 tables being joined. This
 			 * algorithm enforces that.
 			 */
-			FromList	fromList = (FromList) getNodeFactory().getNode(
-									C_NodeTypes.FROM_LIST,
-									getNodeFactory().doJoinOrderOptimization(),
-									getContextManager());
+            FromList fromList = new FromList(
+                    getOptimizerFactory().doJoinOrderOptimization(), cm);
+
 			fromList.addElement((FromTable) leftResultSet);
 			fromList.addElement((FromTable) rightResultSet);
 
@@ -858,10 +852,7 @@ public class JoinNode extends TableOpera
 			 * We need to bind the CRs a side at a time to ensure that
 			 * we don't find an bogus ambiguous column reference. (Bug 377)
 			 */
-			joinClause = (ValueNode) getNodeFactory().getNode(
-											C_NodeTypes.BOOLEAN_CONSTANT_NODE,
-											Boolean.TRUE,
-											getContextManager());
+           joinClause = new BooleanConstantNode(true, cm);
 
 			int usingSize = usingClause.size();
 			for (int index = 0; index < usingSize; index++)
@@ -873,11 +864,10 @@ public class JoinNode extends TableOpera
 
 				/* Create and bind the left CR */
 				fromListParam.insertElementAt(leftResultSet, 0);
-				leftCR = (ColumnReference) getNodeFactory().getNode(
-							C_NodeTypes.COLUMN_REFERENCE,
-							rc.getName(),
-							((FromTable) leftResultSet).getTableName(),
-							getContextManager()); 
+                leftCR = new ColumnReference(
+                        rc.getName(),
+                        ((FromTable) leftResultSet).getTableName(),
+                        cm);
 				leftCR = (ColumnReference) leftCR.bindExpression(
 									  fromListParam, subqueryList,
                                       aggregates);
@@ -885,33 +875,27 @@ public class JoinNode extends TableOpera
 
 				/* Create and bind the right CR */
 				fromListParam.insertElementAt(rightResultSet, 0);
-				rightCR = (ColumnReference) getNodeFactory().getNode(
-							C_NodeTypes.COLUMN_REFERENCE,
-							rc.getName(),
-							((FromTable) rightResultSet).getTableName(),
-							getContextManager()); 
+                rightCR = new ColumnReference(
+                        rc.getName(),
+                        ((FromTable) rightResultSet).getTableName(),
+                        cm);
 				rightCR = (ColumnReference) rightCR.bindExpression(
 									  fromListParam, subqueryList,
                                       aggregates);
 				fromListParam.removeElementAt(0);
 
 				/* Create and insert the new = condition */
-				equalsNode = (BinaryComparisonOperatorNode)
-								getNodeFactory().getNode(
+                equalsNode = new BinaryRelationalOperatorNode(
 										C_NodeTypes.BINARY_EQUALS_OPERATOR_NODE,
 										leftCR,
 										rightCR,
-										Boolean.FALSE,
-										getContextManager());
+                                        false,
+                                        cm);
 				equalsNode.bindComparisonOperator();
 
                 // Create a new join clause by ANDing the new = condition and
                 // the old join clause.
-                AndNode newJoinClause = (AndNode) getNodeFactory().getNode(
-                        C_NodeTypes.AND_NODE,
-                        equalsNode,
-                        joinClause,
-                        getContextManager());
+                AndNode newJoinClause = new AndNode(equalsNode, joinClause, cm);
 
                 newJoinClause.postBindFixup();
 
@@ -976,15 +960,11 @@ public class JoinNode extends TableOpera
         List<String> columnNames = extractColumnNames(leftRCL);
         columnNames.retainAll(extractColumnNames(rightRCL));
 
-        ResultColumnList commonColumns =
-                (ResultColumnList) getNodeFactory().getNode(
-                        C_NodeTypes.RESULT_COLUMN_LIST,
-                        getContextManager());
-
-        for (Iterator it = columnNames.iterator(); it.hasNext(); ) {
-            String name = (String) it.next();
-            ResultColumn rc = (ResultColumn) getNodeFactory().getNode(
-                    C_NodeTypes.RESULT_COLUMN,
+        ResultColumnList
+                commonColumns = new ResultColumnList((getContextManager()));
+
+        for (String name : columnNames) {
+            ResultColumn rc = new ResultColumn(
                     name,
                     null,
                     getContextManager());
@@ -1035,7 +1015,8 @@ public class JoinNode extends TableOpera
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultSetNode preprocess(int numTables,
+    @Override
+    ResultSetNode preprocess(int numTables,
 									GroupByList gbl,
 									FromList fromList)
 								throws StandardException
@@ -1069,17 +1050,12 @@ public class JoinNode extends TableOpera
 				 * flattening will take place. (Bug #1206)
 				 */
 				joinClause.preprocess(
-								numTables,
-								(FromList) getNodeFactory().getNode(
-									C_NodeTypes.FROM_LIST,
-									getNodeFactory().doJoinOrderOptimization(),
-									getContextManager()),
-								(SubqueryList) getNodeFactory().getNode(
-													C_NodeTypes.SUBQUERY_LIST,
-													getContextManager()),
-								(PredicateList) getNodeFactory().getNode(
-													C_NodeTypes.PREDICATE_LIST,
-													getContextManager()));
+                    numTables,
+                    new FromList(
+                        getOptimizerFactory().doJoinOrderOptimization(),
+                        getContextManager()),
+                    new SubqueryList(getContextManager()),
+                    new PredicateList(getContextManager()));
 			}
 
 			/* Pull apart the expression trees */
@@ -1095,6 +1071,7 @@ public class JoinNode extends TableOpera
      * Find the unreferenced result columns and project them out. This is used in pre-processing joins
      * that are not flattened into the where clause.
      */
+    @Override
     void projectResultColumns() throws StandardException
     {
         leftResultSet.projectResultColumns();
@@ -1107,7 +1084,7 @@ public class JoinNode extends TableOpera
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void normExpressions()
+    void normExpressions()
 				throws StandardException
 	{
 		if (joinClauseNormalized == true) return;
@@ -1169,7 +1146,8 @@ public class JoinNode extends TableOpera
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void pushExpressions(PredicateList outerPredicateList)
+    @Override
+    void pushExpressions(PredicateList outerPredicateList)
 					throws StandardException
 	{
 		FromTable		leftFromTable = (FromTable) leftResultSet;
@@ -1422,7 +1400,8 @@ public class JoinNode extends TableOpera
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public FromList flatten(ResultColumnList rcl,
+    @Override
+    FromList flatten(ResultColumnList rcl,
 							PredicateList outerPList,
 							SubqueryList sql,
                             GroupByList gbl,
@@ -1449,10 +1428,9 @@ public class JoinNode extends TableOpera
 		 * since there is no exposed name. (And even if there was,
 		 * we could care less about unique exposed name checking here.)
 		 */
-		FromList	fromList = (FromList) getNodeFactory().getNode(
-									C_NodeTypes.FROM_LIST,
-									getNodeFactory().doJoinOrderOptimization(),
-									getContextManager());
+        FromList fromList = new FromList(
+                getOptimizerFactory().doJoinOrderOptimization(),
+                getContextManager());
 		fromList.addElement((FromTable) leftResultSet);
 		fromList.addElement((FromTable) rightResultSet);
 
@@ -1491,7 +1469,8 @@ public class JoinNode extends TableOpera
 	/**
 	 * Currently we don't reordering any outer join w/ inner joins.
 	 */
-	public boolean LOJ_reorderable(int numTables)
+    @Override
+    boolean LOJ_reorderable(int numTables)
 				throws StandardException
 	{
 		return false;
@@ -1508,6 +1487,7 @@ public class JoinNode extends TableOpera
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
     FromTable transformOuterJoins(ValueNode predicateTree, int numTables)
 		throws StandardException
 	{
@@ -1543,6 +1523,7 @@ public class JoinNode extends TableOpera
 	 *
 	 * @exception StandardException		Thrown on error
      */
+    @Override
     void generate(ActivationClassBuilder acb, MethodBuilder mb)
 							throws StandardException
 	{
@@ -1735,7 +1716,8 @@ public class JoinNode extends TableOpera
 	 *  the costs for the inner and outer table.  The number of rows,
 	 *  though, is that for the inner table only.
 	 */
-	public CostEstimate getFinalCostEstimate()
+    @Override
+    CostEstimate getFinalCostEstimate()
 		throws StandardException
 	{
 		// If we already found it, just return it.
@@ -1794,7 +1776,7 @@ public class JoinNode extends TableOpera
 	 *
 	 * @return String		The joinType as a String.
 	 */
-	public static String joinTypeToString(int joinType)
+    static String joinTypeToString(int joinType)
 	{
 		switch(joinType)
 		{
@@ -1828,9 +1810,7 @@ public class JoinNode extends TableOpera
 	protected PredicateList getLeftPredicateList() throws StandardException
 	{
 		if (leftPredicateList == null)
-			leftPredicateList = (PredicateList) getNodeFactory().getNode(
-													C_NodeTypes.PREDICATE_LIST,
-													getContextManager());
+            leftPredicateList = new PredicateList(getContextManager());
 
 		return leftPredicateList;
 	}
@@ -1838,9 +1818,7 @@ public class JoinNode extends TableOpera
 	protected PredicateList getRightPredicateList() throws StandardException
 	{
 		if (rightPredicateList == null)
-			rightPredicateList = (PredicateList) getNodeFactory().getNode(
-													C_NodeTypes.PREDICATE_LIST,
-													getContextManager());
+            rightPredicateList = new PredicateList(getContextManager());
 
 		return rightPredicateList;
 	}
@@ -1852,7 +1830,8 @@ public class JoinNode extends TableOpera
 	 *
 	 * @return	The lock mode
 	 */
-	public int updateTargetLockMode()
+    @Override
+    int updateTargetLockMode()
 	{
 		/* Always use row locking if we have a join node.
 		 * We can only have a join node if there is a subquery that
@@ -1864,6 +1843,7 @@ public class JoinNode extends TableOpera
 	/**
 	 * Mark this node and its children as not being a flattenable join.
 	 */
+    @Override
 	void notFlattenableJoin()
 	{
 		flattenableJoin = false;
@@ -1877,7 +1857,8 @@ public class JoinNode extends TableOpera
 	 *
 	 * @return boolean		Whether or not this FromTable can be flattened.
 	 */
-	public boolean isFlattenableJoinNode()
+    @Override
+    boolean isFlattenableJoinNode()
 	{
 		return flattenableJoin;
 	}
@@ -1897,6 +1878,7 @@ public class JoinNode extends TableOpera
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
     boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, List<FromBaseTable> fbtHolder)
 				throws StandardException
 	{
@@ -1911,7 +1893,8 @@ public class JoinNode extends TableOpera
 	 * @param depth		The depth of this node in the tree
 	 */
 
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -1990,6 +1973,7 @@ public class JoinNode extends TableOpera
 	 *
 	 * @exception StandardException on error
 	 */
+    @Override
 	void acceptChildren(Visitor v)
 		throws StandardException
 	{
@@ -2021,12 +2005,13 @@ public class JoinNode extends TableOpera
 	//       (T JOIN S) LOJ (X LOJ Y) 
     // The top most LOJ may be a join betw T and X and thus we can reorder the
 	// LOJs.  However, as of 10/2002, we don't reorder LOJ mixed with join.
-	public JBitSet LOJgetReferencedTables(int numTables)
+    @Override
+    JBitSet LOJgetReferencedTables(int numTables)
 				throws StandardException
 	{
-		JBitSet map = (JBitSet) leftResultSet.LOJgetReferencedTables(numTables);
+        JBitSet map = leftResultSet.LOJgetReferencedTables(numTables);
 		if (map == null) return null;
-		else map.or((JBitSet) rightResultSet.LOJgetReferencedTables(numTables));
+        else map.or(rightResultSet.LOJgetReferencedTables(numTables));
 
 		return map;
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LOBTypeCompiler.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LOBTypeCompiler.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LOBTypeCompiler.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LOBTypeCompiler.java Fri Jun 21 07:47:47 2013
@@ -21,113 +21,116 @@
 
 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.io.StoredFormatIds;
-
-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;
-
+import org.apache.derby.iapi.types.DataTypeDescriptor;
+import org.apache.derby.iapi.types.TypeId;
 
 /**
  * This class implements TypeCompiler for the SQL LOB types.
  *
  */
 
-public class LOBTypeCompiler extends BaseTypeCompiler
+class LOBTypeCompiler extends BaseTypeCompiler
 {
-        /**
-         * Tell whether this type (LOB) can be converted to the given type.
-         *
-		 * @see TypeCompiler#convertible
-         */
-        public boolean convertible(TypeId otherType, 
-								   boolean forDataTypeFunction)
-        {
-
-            return  (otherType.isBlobTypeId());
-        }
-
-        /**
-         * Tell whether this type (LOB) is compatible with the given type.
-         *
-         * @param otherType     The TypeId of the other type.
-         */
-		public boolean compatible(TypeId otherType)
-		{
-				return convertible(otherType,false);
-		}
-
-        /**
-         * Tell whether this type (LOB) 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)
-        {
-            // no automatic conversions at store time
-
-			return  (otherType.isBlobTypeId());
-        }
-
-        /** @see TypeCompiler#interfaceName */
-        public String interfaceName()
-        {
-            return ClassName.BitDataValue;
-        }
-
-        /**
-         * @see TypeCompiler#getCorrespondingPrimitiveTypeName
-         */
-
-        public String getCorrespondingPrimitiveTypeName() {
-            int formatId = getStoredFormatIdFromTypeId();
-            switch (formatId) {
-                case StoredFormatIds.BLOB_TYPE_ID:  return "java.sql.Blob";
-                default:
-                    if (SanityManager.DEBUG)
-                        SanityManager.THROWASSERT("unexpected formatId in getCorrespondingPrimitiveTypeName() - " + formatId);
-                    return null;
-            }
-        }
-
-        /**
-         * @see TypeCompiler#getCastToCharWidth
-         */
-        public int getCastToCharWidth(DataTypeDescriptor dts)
-        {
-                return dts.getMaximumWidth();
+    /**
+     * Tell whether this type (LOB) can be converted to the given type.
+     *
+     * @see TypeCompiler#convertible
+     */
+    public boolean convertible(TypeId otherType,
+            boolean forDataTypeFunction)
+    {
+
+        return  (otherType.isBlobTypeId());
+    }
+
+    /**
+     * Tell whether this type (LOB) is compatible with the given type.
+     *
+     * @param otherType     The TypeId of the other type.
+     */
+    public boolean compatible(TypeId otherType)
+    {
+        return convertible(otherType,false);
+    }
+
+    /**
+     * Tell whether this type (LOB) 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)
+    {
+        // no automatic conversions at store time
+
+        return  (otherType.isBlobTypeId());
+    }
+
+    /** @see TypeCompiler#interfaceName */
+    public String interfaceName()
+    {
+        return ClassName.BitDataValue;
+    }
+
+    /**
+     * @see TypeCompiler#getCorrespondingPrimitiveTypeName
+     */
+
+    public String getCorrespondingPrimitiveTypeName() {
+        int formatId = getStoredFormatIdFromTypeId();
+        switch (formatId) {
+            case StoredFormatIds.BLOB_TYPE_ID:  return "java.sql.Blob";
+            default:
+                if (SanityManager.DEBUG) {
+                    SanityManager.THROWASSERT(
+                        "unexpected formatId " +
+                        "in getCorrespondingPrimitiveTypeName() - " + formatId);
+                }
+                return null;
         }
+    }
 
-        String nullMethodName() {
-            int formatId = getStoredFormatIdFromTypeId();
-            switch (formatId) {
-                case StoredFormatIds.BLOB_TYPE_ID:  return "getNullBlob";
-                default:
-                    if (SanityManager.DEBUG)
-                        SanityManager.THROWASSERT("unexpected formatId in nullMethodName() - " + formatId);
-                    return null;
-            }
+    /**
+     * @see TypeCompiler#getCastToCharWidth
+     */
+    public int getCastToCharWidth(DataTypeDescriptor dts)
+    {
+        return dts.getMaximumWidth();
+    }
+
+    String nullMethodName() {
+        int formatId = getStoredFormatIdFromTypeId();
+        switch (formatId) {
+            case StoredFormatIds.BLOB_TYPE_ID:  return "getNullBlob";
+            default:
+                if (SanityManager.DEBUG) {
+                    SanityManager.THROWASSERT(
+                        "unexpected formatId " +
+                        "in nullMethodName() - " + formatId);
+                }
+                return null;
         }
+    }
 
-        String dataValueMethodName()
-        {
-            int formatId = getStoredFormatIdFromTypeId();
-            switch (formatId) {
-                case StoredFormatIds.BLOB_TYPE_ID:  return "getBlobDataValue";
-                default:
-                    if (SanityManager.DEBUG)
-                        SanityManager.THROWASSERT("unexpected formatId in dataValueMethodName() - " + formatId);
-                    return null;
+    @Override
+    String dataValueMethodName()
+    {
+        int formatId = getStoredFormatIdFromTypeId();
+        switch (formatId) {
+            case StoredFormatIds.BLOB_TYPE_ID:  return "getBlobDataValue";
+            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/LengthOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LengthOperatorNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LengthOperatorNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LengthOperatorNode.java Fri Jun 21 07:47:47 2013
@@ -21,19 +21,16 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import java.sql.Types;
+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.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-
 import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-
-import org.apache.derby.iapi.types.TypeId;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
-import org.apache.derby.iapi.reference.SQLState;
-import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.reference.ClassName;
-
-import java.sql.Types;
-
-import java.util.List;
+import org.apache.derby.iapi.types.TypeId;
 
 /**
  * This node represents a unary XXX_length operator
@@ -45,15 +42,22 @@ public final class LengthOperatorNode ex
 	private int parameterType;
 	private int parameterWidth;
 
-	public void setNodeType(int nodeType)
+    LengthOperatorNode(ValueNode operator, ContextManager cm)
+            throws StandardException {
+        super(operator, cm);
+        setNodeType(C_NodeTypes.CHAR_LENGTH_OPERATOR_NODE);
+    }
+
+    @Override
+    void setNodeType(int nodeType)
 	{
-		String operator = null;
-		String methodName = null;
+        String op = null;
+        String methodNam = null;
 
 		if (nodeType == C_NodeTypes.CHAR_LENGTH_OPERATOR_NODE)
 		{
-				operator = "char_length";
-				methodName = "charLength";
+                op = "char_length";
+                methodNam = "charLength";
 				parameterType = Types.VARCHAR;
 				parameterWidth = TypeId.VARCHAR_MAXWIDTH;
 		}
@@ -65,8 +69,8 @@ public final class LengthOperatorNode ex
 						"Unexpected nodeType = " + nodeType);
 				}
 		}
-		setOperator(operator);
-		setMethodName(methodName);
+        setOperator(op);
+        setMethodName(methodNam);
 		super.setNodeType(nodeType);
 	}
 
@@ -81,7 +85,7 @@ public final class LengthOperatorNode ex
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
     ValueNode bindExpression(
         FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)
 			throws StandardException
@@ -129,7 +133,7 @@ public final class LengthOperatorNode ex
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
 	void bindParameter()
 			throws StandardException
 	{
@@ -150,7 +154,8 @@ public final class LengthOperatorNode ex
 	 * This is a length operator node.  Overrides this method
 	 * in UnaryOperatorNode for code generation purposes.
 	 */
-	public String getReceiverInterfaceName() {
+    @Override
+    String getReceiverInterfaceName() {
 	    return ClassName.ConcatableDataValue;
 	}
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LikeEscapeOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LikeEscapeOperatorNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LikeEscapeOperatorNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LikeEscapeOperatorNode.java Fri Jun 21 07:47:47 2013
@@ -21,32 +21,21 @@
 
 package org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-
-
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.List;
 import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.types.TypeId;
-import org.apache.derby.iapi.types.StringDataValue;
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-
-import org.apache.derby.iapi.sql.compile.TypeCompiler;
-
 import org.apache.derby.iapi.reference.SQLState;
-
-
-import org.apache.derby.iapi.util.ReuseFactory;
-
 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.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.Like;
+import org.apache.derby.iapi.types.StringDataValue;
+import org.apache.derby.iapi.types.TypeId;
 
-import java.sql.Types;
-import java.util.Arrays;
-import java.util.List;
-
-  
 /**
     This node represents a like comparison operator (no escape)
 
@@ -110,7 +99,7 @@ public final class LikeEscapeOperatorNod
     String  escape;
 
     /**
-     * Initializer for a LikeEscapeOperatorNode
+     * Constructor for a LikeEscapeOperatorNode
      *
      * receiver like pattern [ escape escapeValue ]
      *
@@ -118,16 +107,22 @@ public final class LikeEscapeOperatorNod
      *                              column, CharConstant or Parameter
      * @param leftOperand   The right operand of the like: the pattern
      * @param rightOperand  The optional escape clause, null if not present
+     * @param cm            The context manager
      */
-    public void init(
-    Object receiver,
-    Object leftOperand,
-    Object rightOperand)
+    LikeEscapeOperatorNode(
+            ValueNode receiver,
+            ValueNode leftOperand,
+            ValueNode rightOperand,
+            ContextManager cm)
     {
         /* By convention, the method name for the like operator is "like" */
-        super.init(
-            receiver, leftOperand, rightOperand, 
-            ReuseFactory.getInteger(TernaryOperatorNode.LIKE), null); 
+        super(receiver,
+              leftOperand,
+              rightOperand,
+              TernaryOperatorNode.LIKE,
+              -1, // default trimType
+              cm);
+        setNodeType(C_NodeTypes.LIKE_ESCAPE_OPERATOR_NODE);
     }
 
     /**
@@ -254,9 +249,6 @@ public final class LikeEscapeOperatorNod
 
         bindToBuiltIn();
 
-        TypeCompiler receiverTC = receiver.getTypeCompiler();
-        TypeCompiler leftTC     = leftOperand.getTypeCompiler();
-
         /* The receiver must be a string type
         */
         if (! receiver.getTypeId().isStringTypeId())
@@ -271,7 +263,6 @@ public final class LikeEscapeOperatorNod
         if (!leftOperand.getTypeId().isStringTypeId())
         {
             leftOperand = castArgToString(leftOperand);
-            leftTC      = leftOperand.getTypeCompiler();
         }
 
         if (rightOperand != null)
@@ -389,14 +380,12 @@ public final class LikeEscapeOperatorNod
                     //     /   \
                     //  column  'Derby'
                     BinaryComparisonOperatorNode equals = 
-                        (BinaryComparisonOperatorNode) getNodeFactory().getNode(
+                        new BinaryRelationalOperatorNode(
                             C_NodeTypes.BINARY_EQUALS_OPERATOR_NODE,
                             leftClone, 
-                            (ValueNode) getNodeFactory().getNode(
-                                C_NodeTypes.CHAR_CONSTANT_NODE,
-                                newPattern,
-                                getContextManager()),
-                                Boolean.FALSE,
+                            new CharConstantNode(newPattern,
+                                                 getContextManager()),
+                            false,
                             getContextManager());
 
                     // Set forQueryRewrite to bypass comparability checks
@@ -414,12 +403,8 @@ public final class LikeEscapeOperatorNod
                     //           / \
                     //       column 'Derby'
 
-                    AndNode newAnd = 
-                        (AndNode) getNodeFactory().getNode(
-                                    C_NodeTypes.AND_NODE,
-                                    this,
-                                    equals,
-                                    getContextManager());
+                    AndNode newAnd =
+                            new AndNode(this, equals, getContextManager());
 
                     finishBindExpr();
                     newAnd.postBindFixup();
@@ -510,6 +495,7 @@ public final class LikeEscapeOperatorNod
     *
     * @exception StandardException  Thrown on error
     */
+    @Override
     public ValueNode preprocess(
     int             numTables,
     FromList        outerFromList,
@@ -637,11 +623,7 @@ public final class LikeEscapeOperatorNod
          */
 
         AndNode   newAnd   = null;
-        ValueNode trueNode = 
-            (ValueNode) getNodeFactory().getNode(
-                            C_NodeTypes.BOOLEAN_CONSTANT_NODE,
-                            Boolean.TRUE,
-                            getContextManager());
+        ValueNode trueNode = new BooleanConstantNode(true, getContextManager());
 
         /* Create the AND <, if lessThanString is non-null or 
          * leftOperand is a parameter.
@@ -649,7 +631,7 @@ public final class LikeEscapeOperatorNod
         if (lessThanString != null || 
             leftOperand.requiresTypeFromContext())
         {
-            QueryTreeNode likeLTopt;
+            ValueNode likeLTopt;
             if (leftOperand.requiresTypeFromContext())
             {
                 // pattern string is a parameter 
@@ -665,19 +647,16 @@ public final class LikeEscapeOperatorNod
             {
                 // pattern string is a constant
                 likeLTopt = 
-                    (QueryTreeNode) getNodeFactory().getNode(
-                        C_NodeTypes.CHAR_CONSTANT_NODE,
-                        lessThanString,
-                        getContextManager());
+                    new CharConstantNode(lessThanString, getContextManager());
             }
 
             BinaryComparisonOperatorNode lessThan = 
-                (BinaryComparisonOperatorNode) getNodeFactory().getNode(
+                new BinaryRelationalOperatorNode(
                     C_NodeTypes.BINARY_LESS_THAN_OPERATOR_NODE,
                     receiver.getClone(), 
                     likeLTopt,
-                    Boolean.FALSE,
-                   getContextManager());
+                    false,
+                    getContextManager());
 
             // Disable comparability checks
             lessThan.setForQueryRewrite(true);
@@ -688,11 +667,7 @@ public final class LikeEscapeOperatorNod
             lessThan.setBetweenSelectivity();
 
             /* Create the AND */
-            newAnd = (AndNode) getNodeFactory().getNode(
-                C_NodeTypes.AND_NODE,
-                lessThan,
-                trueNode,
-                getContextManager());
+            newAnd = new AndNode(lessThan, trueNode, getContextManager());
 
             newAnd.postBindFixup();
         }
@@ -721,10 +696,7 @@ public final class LikeEscapeOperatorNod
             // the pattern is a constant, eg. c1 LIKE 'Derby'
 
             likeGEopt = 
-                (ValueNode) getNodeFactory().getNode(
-                    C_NodeTypes.CHAR_CONSTANT_NODE,
-                    greaterEqualString,
-                    getContextManager());
+                new CharConstantNode(greaterEqualString, getContextManager());
         }
 
         // greaterEqual from (reciever LIKE pattern):
@@ -732,11 +704,11 @@ public final class LikeEscapeOperatorNod
         //      /   \
         //  reciever pattern
         BinaryComparisonOperatorNode greaterEqual = 
-            (BinaryComparisonOperatorNode) getNodeFactory().getNode(
+            new BinaryRelationalOperatorNode(
                 C_NodeTypes.BINARY_GREATER_EQUALS_OPERATOR_NODE,
                 receiver.getClone(), 
                 likeGEopt,
-                Boolean.FALSE,
+                false,
                 getContextManager());
 
 
@@ -751,19 +723,11 @@ public final class LikeEscapeOperatorNod
         /* Create the AND */
         if (newAnd == null)
         {
-            newAnd = (AndNode) getNodeFactory().getNode(
-                C_NodeTypes.AND_NODE,
-                greaterEqual,
-                trueNode,
-                getContextManager());
+            newAnd = new AndNode(greaterEqual, trueNode, getContextManager());
         }
         else
         {
-            newAnd = (AndNode) getNodeFactory().getNode(
-                C_NodeTypes.AND_NODE,
-                greaterEqual,
-                newAnd,
-                getContextManager());
+            newAnd = new AndNode(greaterEqual, newAnd, getContextManager());
         }
         newAnd.postBindFixup();
 
@@ -772,13 +736,7 @@ public final class LikeEscapeOperatorNod
          */
         if (!eliminateLikeComparison)
         {
-            newAnd = (AndNode) 
-                getNodeFactory().getNode(
-                    C_NodeTypes.AND_NODE,
-                    this,
-                    newAnd,
-                    getContextManager());
-
+            newAnd = new AndNode(this, newAnd, getContextManager());
             newAnd.postBindFixup();
         }
 
@@ -801,7 +759,7 @@ public final class LikeEscapeOperatorNod
      *
      * @exception StandardException Thrown on error
      */
-
+    @Override
     void generateExpression(
     ExpressionClassBuilder acb, MethodBuilder mb)
         throws StandardException
@@ -873,9 +831,7 @@ public final class LikeEscapeOperatorNod
             methodName += "WithEsc";
         }
 
-        StaticMethodCallNode methodCall = (StaticMethodCallNode)
-            getNodeFactory().getNode(
-                C_NodeTypes.STATIC_METHOD_CALL_NODE,
+        StaticMethodCallNode methodCall = new StaticMethodCallNode(
                 methodName,
                 "org.apache.derby.iapi.types.Like",
                 getContextManager());
@@ -883,29 +839,23 @@ public final class LikeEscapeOperatorNod
         // using a method call directly, thus need internal sql capability
         methodCall.internalCall = true;
 
-        QueryTreeNode maxWidthNode = (QueryTreeNode) getNodeFactory().getNode(
-            C_NodeTypes.INT_CONSTANT_NODE,
-            new Integer(maxWidth),
+        NumericConstantNode maxWidthNode = new NumericConstantNode(
+            TypeId.getBuiltInTypeId(Types.INTEGER),
+            Integer.valueOf(maxWidth),
             getContextManager());
 
-        QueryTreeNode[] param = (escapeNode == null) ?
-            new QueryTreeNode[] { parameterNode, maxWidthNode } :
-            new QueryTreeNode[] { parameterNode, escapeNode, maxWidthNode };
+        ValueNode[] param = (escapeNode == null) ?
+            new ValueNode[] { parameterNode, maxWidthNode } :
+            new ValueNode[] { parameterNode, escapeNode, maxWidthNode };
 
         methodCall.addParms(Arrays.asList(param));
 
         ValueNode java2SQL = 
-            (ValueNode) getNodeFactory().getNode(
-                C_NodeTypes.JAVA_TO_SQL_VALUE_NODE,
-                methodCall,
-                getContextManager());
-
+                new JavaToSQLValueNode(methodCall, getContextManager());
 
-        java2SQL = (ValueNode) java2SQL.bindExpression(null, null, null);
+        java2SQL = java2SQL.bindExpression(null, null, null);
 
-        CastNode likeOpt = (CastNode)
-        getNodeFactory().getNode(
-            C_NodeTypes.CAST_NODE,
+        CastNode likeOpt = new CastNode(
             java2SQL,
             parameterNode.getTypeServices(),
             getContextManager());

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LockTableNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LockTableNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LockTableNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LockTableNode.java Fri Jun 21 07:47:47 2013
@@ -23,11 +23,12 @@ package	org.apache.derby.impl.sql.compil
 
 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.compile.CompilerContext;
 import org.apache.derby.iapi.sql.conn.Authorizer;
 import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
-import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.sql.execute.ConstantAction;
@@ -38,32 +39,35 @@ import org.apache.derby.iapi.sql.execute
  *
  */
 
-public class LockTableNode extends MiscellaneousStatementNode
+class LockTableNode extends MiscellaneousStatementNode
 {
 	private TableName	tableName;
 	private boolean		exclusiveMode;
 	private long		conglomerateNumber;
 	private TableDescriptor			lockTableDescriptor;
 
-	/**
-	 * Initializer for LockTableNode
-	 *
-	 * @param tableName		The table to lock
-	 * @param exclusiveMode	boolean, whether or not to get an exclusive lock.
-	 */
-	public void init(Object tableName, Object exclusiveMode)
-	{
-		this.tableName = (TableName) tableName;
-		this.exclusiveMode = ((Boolean) exclusiveMode).booleanValue();
-	}
+    /**
+     * @param tableName The table to lock
+     * @param exclusiveMode Whether or not to get an exclusive lock.
+     * @param cm Context manager
+     */
+    LockTableNode(
+            TableName tableName,
+            boolean exclusiveMode,
+            ContextManager cm) {
+        super(cm);
+        this.tableName = tableName;
+        this.exclusiveMode = exclusiveMode;
+        setNodeType(C_NodeTypes.LOCK_TABLE_NODE);
+    }
 
-	/**
+    /**
 	 * 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)
@@ -79,7 +83,7 @@ public class LockTableNode extends Misce
 		}
 	}
 
-	public String statementToString()
+    String statementToString()
 	{
 		return "LOCK TABLE";
 	}
@@ -91,12 +95,11 @@ public class LockTableNode extends Misce
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
 	public void bindStatement() throws StandardException
 	{
 		CompilerContext			cc = getCompilerContext();
 		ConglomerateDescriptor	cd;
-		DataDictionary			dd = getDataDictionary();
 		SchemaDescriptor		sd;
 
 		String schemaName = tableName.getSchemaName();
@@ -156,6 +159,7 @@ public class LockTableNode extends Misce
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public boolean referencesSessionSchema()
 		throws StandardException
 	{
@@ -168,7 +172,8 @@ public class LockTableNode extends Misce
 	 *
 	 * @exception StandardException		Thrown on failure
 	 */
-	public ConstantAction	makeConstantAction() throws StandardException
+    @Override
+    public ConstantAction makeConstantAction() throws StandardException
 	{
 		return getGenericConstantActionFactory().getLockTableConstantAction(
 						tableName.getFullTableName(),

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaterializeResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaterializeResultSetNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaterializeResultSetNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaterializeResultSetNode.java Fri Jun 21 07:47:47 2013
@@ -21,14 +21,14 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import java.util.Properties;
 import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.reference.ClassName;
-
 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.sanity.SanityManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 
 /**
  * A MaterializeResultSetNode represents a materialization result set for any 
@@ -36,22 +36,24 @@ import org.apache.derby.iapi.services.cl
  *
  */
 
-public class MaterializeResultSetNode extends SingleChildResultSetNode
+class MaterializeResultSetNode extends SingleChildResultSetNode
 {
 	/**
-	 * Initializer for a MaterializeResultSetNode.
+     * Constructor for a MaterializeResultSetNode.
 	 *
 	 * @param childResult	The child ResultSetNode
 	 * @param rcl			The RCL for the node
 	 * @param tableProperties	Properties list associated with the table
+     * @param cm            The context manager
 	 */
 
-	public void init(Object childResult,
-								Object rcl,
-								Object tableProperties)
-	{
-		super.init(childResult, tableProperties);
-		resultColumns = (ResultColumnList) rcl;
+    MaterializeResultSetNode(ResultSetNode childResult,
+                             ResultColumnList rcl,
+                             Properties tableProperties,
+                             ContextManager cm) {
+        super(childResult, tableProperties, cm);
+        setNodeType(C_NodeTypes.MATERIALIZE_RESULT_SET_NODE);
+        resultColumns = rcl;
 	}
 
 	/**
@@ -60,8 +62,8 @@ public class MaterializeResultSetNode ex
 	 *
 	 * @param depth		The depth of this node in the tree
 	 */
-
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -74,6 +76,7 @@ public class MaterializeResultSetNode ex
 	 *
 	 * @exception StandardException		Thrown on error
      */
+    @Override
     void generate(ActivationClassBuilder acb, MethodBuilder mb)
 							throws StandardException
 	{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaterializeSubqueryNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaterializeSubqueryNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaterializeSubqueryNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaterializeSubqueryNode.java Fri Jun 21 07:47:47 2013
@@ -21,13 +21,14 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
-import org.apache.derby.iapi.services.compiler.LocalField;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.ClassName;
 import org.apache.derby.iapi.services.classfile.VMOpcode;
+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.sql.compile.C_NodeTypes;
 
-import org.apache.derby.impl.sql.compile.ActivationClassBuilder;
 
 /**
  * A MaterializeSubqueryNode is used to replace the nodes for a subquery, to facilitate
@@ -39,11 +40,13 @@ class MaterializeSubqueryNode extends Re
 
 	private LocalField lf;
 
-	public MaterializeSubqueryNode(LocalField lf)
-	{
+    MaterializeSubqueryNode(LocalField lf, ContextManager cm) {
+        super(cm);
+        setNodeType(C_NodeTypes.MATERIALIZE_RESULT_SET_NODE);
 		this.lf = lf;
 	}
 
+    @Override
     void generate(ActivationClassBuilder acb, MethodBuilder mb)
 		throws StandardException
 	{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaxMinAggregateDefinition.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaxMinAggregateDefinition.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaxMinAggregateDefinition.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaxMinAggregateDefinition.java Fri Jun 21 07:47:47 2013
@@ -21,26 +21,17 @@
 
 package org.apache.derby.impl.sql.compile;
 
+import org.apache.derby.iapi.reference.ClassName;
+import org.apache.derby.iapi.services.context.ContextService;
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.impl.sql.execute.MaxMinAggregator;
-
-import org.apache.derby.catalog.TypeDescriptor;
-import org.apache.derby.iapi.types.TypeId;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
-import org.apache.derby.iapi.types.NumberDataValue;
-
-import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.services.context.ContextService;
-import org.apache.derby.iapi.reference.ClassName;
+import org.apache.derby.iapi.types.TypeId;
 
 /**
  * Defintion for the MAX()/MIN() aggregates.
  *
  */
-public class MaxMinAggregateDefinition 
+class MaxMinAggregateDefinition
 		implements AggregateDefinition 
 {
 	private boolean isMax;
@@ -49,7 +40,7 @@ public class MaxMinAggregateDefinition 
 	 * Niladic constructor.  Does nothing.  For ease
 	 * Of use, only.
 	 */
-	public MaxMinAggregateDefinition() { super(); }
+    MaxMinAggregateDefinition() { super(); }
 
 	/**
 	 * Determines the result datatype.  Accept NumberDataValues
@@ -94,7 +85,7 @@ public class MaxMinAggregateDefinition 
 	/**
 	 * This is set by the parser.
 	 */
-	public final void setMaxOrMin(boolean isMax)
+    final void setMaxOrMin(boolean isMax)
 	{
 		this.isMax = isMax;
 	}
@@ -104,7 +95,7 @@ public class MaxMinAggregateDefinition 
 	 *
 	 * @return boolean true/false
 	 */
-	public final boolean isMax()
+    final boolean isMax()
 	{
 		return(isMax);
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java Fri Jun 21 07:47:47 2013
@@ -21,47 +21,33 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.services.loader.ClassInspector;
-
+import java.lang.reflect.Member;
+import java.lang.reflect.Modifier;
+import java.sql.ParameterMetaData;
+import java.sql.ResultSet;
+import java.util.List;
+import java.util.StringTokenizer;
+import org.apache.derby.catalog.TypeDescriptor;
+import org.apache.derby.catalog.types.RoutineAliasInfo;
+import org.apache.derby.catalog.types.TypeDescriptorImpl;
+import org.apache.derby.catalog.types.UserDefinedTypeIdImpl;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.SQLState;
 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.loader.ClassInspector;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.types.TypeId;
-import org.apache.derby.iapi.types.JSQLType;
-
-import org.apache.derby.iapi.sql.compile.Visitor;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
-
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-
 import org.apache.derby.iapi.sql.compile.TypeCompiler;
 import org.apache.derby.iapi.sql.compile.TypeCompilerFactory;
-import org.apache.derby.catalog.TypeDescriptor;
-
-import org.apache.derby.catalog.types.TypeDescriptorImpl;
-import org.apache.derby.catalog.types.UserDefinedTypeIdImpl;
-
-import org.apache.derby.iapi.reference.SQLState;
-
+import org.apache.derby.iapi.sql.compile.Visitor;
 import org.apache.derby.iapi.store.access.Qualifier;
-
+import org.apache.derby.iapi.types.DataTypeDescriptor;
+import org.apache.derby.iapi.types.JSQLType;
+import org.apache.derby.iapi.types.TypeId;
 import org.apache.derby.iapi.util.JBitSet;
 
-import org.apache.derby.catalog.types.RoutineAliasInfo;
-
-import java.lang.reflect.Member;
-import java.lang.reflect.Modifier;
-
-import java.sql.ParameterMetaData;
-import java.sql.ResultSet;
-import java.util.List;
-import java.util.StringTokenizer;
-
 /**
  * A MethodCallNode represents a Java method call.  Method calls can be done
  * through DML (as expressions) or through the CALL statement.
@@ -116,17 +102,12 @@ abstract class MethodCallNode extends Ja
 	*/
 	String[] methodParameterTypes;
 
-	/**
-	 * Initializer for a MethodCallNode
-	 *
-	 * @param	methodName	The name of the method to call
-	 */
-	public void init(Object methodName)
-	{
-		this.methodName = (String) methodName;
-	}
+    MethodCallNode(String methodName, ContextManager cm) {
+        super(cm);
+        this.methodName = methodName;
+    }
 
-	public String getMethodName()
+    String getMethodName()
 	{
 		return  methodName;
 	}
@@ -163,32 +144,23 @@ abstract class MethodCallNode extends Ja
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void addParms(List parameterList) throws StandardException
+    void addParms(List<ValueNode> parameterList) throws StandardException
 	{
 		methodParms = new JavaValueNode[parameterList.size()];
 
 		int	plSize = parameterList.size();
 		for (int index = 0; index < plSize; index++)
 		{
-			QueryTreeNode	qt;
-
-			qt = (QueryTreeNode) parameterList.get(index);
+            ValueNode qt = parameterList.get(index);
 
 			/*
 			** Since we need the parameter to be in Java domain format, put a
-			** SQLToJavaValueNode on top of the parameter node if it is a 
-			** SQLValueNode. But if the parameter is already in Java domain 
-			** format, then we don't need to do anything.
+            ** SQLToJavaValueNode on top of the ValueNode parameter node.
 			*/
-			if ( ! (qt instanceof JavaValueNode))
-			{
-				qt = (QueryTreeNode) getNodeFactory().getNode(
-						C_NodeTypes.SQL_TO_JAVA_VALUE_NODE, 
-						qt, 
-						getContextManager());
-			}
+            JavaValueNode jqt =
+                new SQLToJavaValueNode(qt, getContextManager());
 
-			methodParms[index] = (JavaValueNode) qt;
+            methodParms[index] = jqt;
 		}
 	}
 
@@ -252,8 +224,8 @@ abstract class MethodCallNode extends Ja
 	 *
 	 * @param depth		The depth of this node in the tree
 	 */
-
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -280,7 +252,7 @@ abstract class MethodCallNode extends Ja
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
@@ -366,9 +338,7 @@ abstract class MethodCallNode extends Ja
 		throws StandardException
 	{
 		/* Put the parameter type names into a single string */
-		StringBuffer	parmTypes = new StringBuffer();
-        boolean hasVarargs = hasVarargs();
-        int     firstVarargIdx = getFirstVarargIdx();
+        StringBuilder   parmTypes = new StringBuilder();
         int     paramCount = signature.length;
 		for (int i = 0; i < paramCount; i++)
 		{
@@ -744,7 +714,7 @@ abstract class MethodCallNode extends Ja
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void	setNullParameterInfo(String[] parmTypeNames)
+    void    setNullParameterInfo(String[] parmTypeNames)
 			throws StandardException
 	{
 		for (int i = 0; i < methodParms.length; i++)
@@ -1313,16 +1283,16 @@ abstract class MethodCallNode extends Ja
 	{
 		int					count = signature.length;
 		String[] 			primParmTypeNames = new String[ count ];
-		JSQLType			jsqlType;
+        JSQLType            jsqlTyp;
 
 		for (int i = 0; i < count; i++)
 		{
-			jsqlType = signature[ i ];
+            jsqlTyp = signature[ i ];
 
-			if ( jsqlType == null ) { primParmTypeNames[i] = ""; }
+            if ( jsqlTyp == null ) { primParmTypeNames[i] = ""; }
 			else
 			{
-				switch( jsqlType.getCategory() )
+                switch( jsqlTyp.getCategory() )
 			    {
 			        case JSQLType.SQLTYPE:
 
@@ -1335,7 +1305,7 @@ abstract class MethodCallNode extends Ja
 						} else {
 
 
-							TypeId	ctid = mapToTypeID( jsqlType );
+                            TypeId  ctid = mapToTypeID( jsqlTyp );
 
 							if ((ctid.isNumericTypeId() && !ctid.isDecimalTypeId()) || ctid.isBooleanTypeId())
 							{
@@ -1350,19 +1320,23 @@ abstract class MethodCallNode extends Ja
 
 		            case JSQLType.JAVA_CLASS:
 
-						primParmTypeNames[i] = jsqlType.getJavaClassName();
+                        primParmTypeNames[i] = jsqlTyp.getJavaClassName();
 						break;
 
 		            case JSQLType.JAVA_PRIMITIVE:
 
-						primParmTypeNames[i] = JSQLType.getPrimitiveName( jsqlType.getPrimitiveKind() );
+                        primParmTypeNames[i] = JSQLType.getPrimitiveName(
+                            jsqlTyp.getPrimitiveKind());
+
 						if ( castToPrimitiveAsNecessary) { methodParms[i].castToPrimitive(true); }
 						break;
 
 		            default:
 
-						if (SanityManager.DEBUG)
-							{ SanityManager.THROWASSERT( "Unknown JSQLType: " + jsqlType ); }
+                        if (SanityManager.DEBUG) {
+                            SanityManager.THROWASSERT(
+                                "Unknown JSQLType: " + jsqlTyp );
+                        }
 
 				}	// end switch
 
@@ -1385,6 +1359,7 @@ abstract class MethodCallNode extends Ja
 	 *
 	 * @return	The variant type for the underlying expression.
 	 */
+    @Override
     int getOrderableVariantType() throws StandardException
 	{
 		// beetle 4880. We return the most variant type of the parameters. If no
@@ -1425,6 +1400,7 @@ abstract class MethodCallNode extends Ja
     /**
      * Override method in ancestor.
      */
+    @Override
     DataTypeDescriptor getDataType() throws StandardException
     {
         if ( routineInfo != null )
@@ -1448,7 +1424,7 @@ abstract class MethodCallNode extends Ja
 	 * 
 	 * @return	The method parameters
 	 */
-	public JavaValueNode[]	getMethodParms()
+    JavaValueNode[] getMethodParms()
 	{
 		return methodParms;
 	}
@@ -1460,6 +1436,7 @@ abstract class MethodCallNode extends Ja
 	 *
 	 * @exception StandardException on error
 	 */
+    @Override
 	void acceptChildren(Visitor v)
 		throws StandardException
 	{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MiscellaneousStatementNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MiscellaneousStatementNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MiscellaneousStatementNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MiscellaneousStatementNode.java Fri Jun 21 07:47:47 2013
@@ -21,26 +21,15 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.services.context.ContextManager;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
-
-import org.apache.derby.iapi.sql.ResultSet;
-import org.apache.derby.iapi.sql.Activation;
-import org.apache.derby.iapi.sql.execute.ConstantAction;
-import org.apache.derby.iapi.reference.ClassName;
-
 import org.apache.derby.iapi.error.StandardException;
-
+import org.apache.derby.iapi.reference.ClassName;
 import org.apache.derby.iapi.services.classfile.VMOpcode;
-
-import org.apache.derby.impl.sql.compile.ActivationClassBuilder;
+import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import org.apache.derby.iapi.services.context.ContextManager;
 
 /**
  * A MiscellaneousStatement represents any type of statement that doesn't
- * fit into the well defined categores: 
+ * fit into the well defined categories:
  * SET (non-transaction).
  *
  */
@@ -48,6 +37,10 @@ import org.apache.derby.impl.sql.compile
 abstract class MiscellaneousStatementNode extends StatementNode
 {
 
+    MiscellaneousStatementNode(ContextManager cm) {
+        super(cm);
+    }
+
 	int activationKind()
 	{
 		   return StatementNode.NEED_NOTHING_ACTIVATION;
@@ -62,7 +55,7 @@ abstract class MiscellaneousStatementNod
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
     void generate(ActivationClassBuilder acb, MethodBuilder mb)
 							throws StandardException
 	{
@@ -84,6 +77,7 @@ abstract class MiscellaneousStatementNod
 	 *
 	 * @return boolean	Whether or not this Statement requires a set/clear savepoint
 	 */
+    @Override
 	public boolean needsSavepoint()
 	{
 		return false;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java Fri Jun 21 07:47:47 2013
@@ -21,46 +21,49 @@
 
 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 org.apache.derby.catalog.UUID;
+import org.apache.derby.catalog.types.DefaultInfoImpl;
 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.ColumnDescriptor;
+import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor;
+import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.DefaultDescriptor;
-import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
-import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList;
 import org.apache.derby.iapi.sql.dictionary.KeyConstraintDescriptor;
-import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor;
-
-import org.apache.derby.iapi.types.TypeId;
+import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
-import org.apache.derby.iapi.types.StringDataValue;
-
-import org.apache.derby.iapi.reference.SQLState;
-
+import org.apache.derby.iapi.types.TypeId;
 import org.apache.derby.impl.sql.execute.ColumnInfo;
-import org.apache.derby.catalog.TypeDescriptor;
-import org.apache.derby.catalog.UUID;
-import org.apache.derby.catalog.types.DefaultInfoImpl;
 
 /**
  * A ModifyColumnNode represents a modify column in an ALTER TABLE statement.
  *
  */
 
-public class ModifyColumnNode extends ColumnDefinitionNode
+class ModifyColumnNode extends ColumnDefinitionNode
 {
 	int		columnPosition = -1;
 	UUID	oldDefaultUUID;
 
+    ModifyColumnNode(int type,
+            String name,
+            ValueNode defaultNode,
+            DataTypeDescriptor dataTypeServices,
+            long[] autoIncrementInfo,
+            ContextManager cm) throws StandardException {
+        super(name, defaultNode, dataTypeServices, autoIncrementInfo, cm);
+        setNodeType(type);
+    }
 	/**
 	 * Get the UUID of the old column default.
 	 *
 	 * @return The UUID of the old column default.
 	 */
+    @Override
 	UUID getOldDefaultUUID()
 	{
 		return oldDefaultUUID;
@@ -71,7 +74,7 @@ public class ModifyColumnNode extends Co
 	 *
 	 * @return The column position for the column.
 	 */
-	public int getColumnPosition()
+    int getColumnPosition()
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -89,8 +92,8 @@ public class ModifyColumnNode extends Co
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public void checkUserType(TableDescriptor td)
+    @Override
+    void checkUserType(TableDescriptor td)
 		throws StandardException
 	{
 		if (getNodeType() != C_NodeTypes.MODIFY_COLUMN_TYPE_NODE)
@@ -151,7 +154,7 @@ public class ModifyColumnNode extends Co
 	 * @exception StandardException		Thrown on Error.
 	 *
 	 */
-	public void checkExistingConstraints(TableDescriptor td)
+    void checkExistingConstraints(TableDescriptor td)
 	             throws StandardException
 	{
 		if ((getNodeType() != C_NodeTypes.MODIFY_COLUMN_TYPE_NODE) &&
@@ -248,7 +251,7 @@ public class ModifyColumnNode extends Co
 	 * @param td Table Descriptor that holds the column which is being altered
 	 * @throws StandardException
 	 */
-	public void useExistingCollation(TableDescriptor td)
+    void useExistingCollation(TableDescriptor td)
     throws StandardException
     {
 		ColumnDescriptor cd;
@@ -272,6 +275,7 @@ public class ModifyColumnNode extends Co
 	 *
 	 * @return The action associated with this node.
 	 */
+    @Override
 	int getAction()
 	{
 		switch (getNodeType())
@@ -310,6 +314,7 @@ public class ModifyColumnNode extends Co
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	void bindAndValidateDefault(DataDictionary dd, TableDescriptor td) 
 		throws StandardException
 	{
@@ -388,8 +393,10 @@ public class ModifyColumnNode extends Co
 	 * modifying an existing column (includes checking if autoincrement is set
 	 * when making a column nullable)
 	 */
-	public void validateAutoincrement(DataDictionary dd, TableDescriptor td, int tableType)
-	         throws StandardException
+    @Override
+    void validateAutoincrement(DataDictionary dd,
+                               TableDescriptor td,
+                               int tableType) throws StandardException
 	{
 		ColumnDescriptor cd;
 



Mime
View raw message