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 [12/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/OrderedColumn.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderedColumn.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderedColumn.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderedColumn.java Fri Jun 21 07:47:47 2013
@@ -21,6 +21,7 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
 /**
@@ -34,6 +35,11 @@ public abstract class OrderedColumn exte
 	protected static final int UNMATCHEDPOSITION = -1;
 	protected int	columnPosition = UNMATCHEDPOSITION;
 
+    public OrderedColumn(ContextManager cm) {
+        super(cm);
+    }
+
+
 	/**
 	 * Indicate whether this column is ascending or not.
 	 * By default assume that all ordered columns are
@@ -43,7 +49,7 @@ public abstract class OrderedColumn exte
 	 *
 	 * @return true
 	 */
-	public boolean isAscending()
+    boolean isAscending()
 	{
 		return true;
 	}
@@ -57,7 +63,7 @@ public abstract class OrderedColumn exte
 	 *
 	 * @return false
 	 */
-	public boolean isNullsOrderedLow()
+    boolean isNullsOrderedLow()
 	{
 		return false;
 	}
@@ -68,6 +74,7 @@ public abstract class OrderedColumn exte
 	 *
 	 * @return	This object as a String
 	 */
+    @Override
 	public String toString() 
 	{
 		if (SanityManager.DEBUG)
@@ -86,7 +93,7 @@ public abstract class OrderedColumn exte
 	 *
 	 * @return	The position of this column
 	 */
-	public int getColumnPosition() 
+    int getColumnPosition()
 	{
 		return columnPosition;
 	}
@@ -94,7 +101,7 @@ public abstract class OrderedColumn exte
 	/**
 	 * Set the position of this column
 	 */
-	public void setColumnPosition(int columnPosition) 
+    void setColumnPosition(int columnPosition)
 	{
 		this.columnPosition = columnPosition;
 		if (SanityManager.DEBUG)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderedColumnList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderedColumnList.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderedColumnList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderedColumnList.java Fri Jun 21 07:47:47 2013
@@ -22,20 +22,24 @@
 package	org.apache.derby.impl.sql.compile;
 
 import java.util.HashSet;
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.util.ReuseFactory;
 import org.apache.derby.impl.sql.execute.IndexColumnOrder;
 
-
 /**
  * List of OrderedColumns
  *
  */
 public abstract class OrderedColumnList extends QueryTreeNodeVector
 {
+    public OrderedColumnList(ContextManager cm) {
+        super(cm);
+    }
+
 	/**
 	 * Get an array of ColumnOrderings to pass to the store
 	 */
-	public IndexColumnOrder[] getColumnOrdering()
+    IndexColumnOrder[] getColumnOrdering()
 	{
 		IndexColumnOrder[] ordering;
 		int numCols = size();

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParameterNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParameterNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParameterNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParameterNode.java Fri Jun 21 07:47:47 2013
@@ -23,12 +23,13 @@ package	org.apache.derby.impl.sql.compil
 
 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.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.CompilerContext;
 import org.apache.derby.iapi.store.access.Qualifier;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
@@ -105,25 +106,20 @@ public class ParameterNode extends Value
 	private ValueNode valToGenerate;
 
 	/**
-	 * Constructor for use by the NodeFactory
-	 */
-	public ParameterNode()
-	{
-	}
-
-	/**
-	 * Initializer for a ParameterNode.
+     * Constructor for a ParameterNode.
 	 *
 	 * @param parameterNumber			The number of this parameter,
 	 *									(unique per query starting at 0)
 	 * @param defaultValue				The default value for this parameter
-	 *
+     * @param cm                        The context manager
 	 */
-
-	public void init(Object parameterNumber, Object defaultValue)
-	{
-		this.defaultValue = (DataValueDescriptor) defaultValue;
-		this.parameterNumber = ((Integer) parameterNumber).intValue();
+    ParameterNode(int parameterNumber,
+                  DataValueDescriptor defaultValue,
+                  ContextManager cm) {
+        super(cm);
+        setNodeType(C_NodeTypes.PARAMETER_NODE);
+        this.parameterNumber = parameterNumber;
+        this.defaultValue = defaultValue;
 	}
 
 	/**
@@ -154,8 +150,8 @@ public class ParameterNode extends Value
 	 *
 	 * @param descriptor	The DataTypeServices to set for this parameter
 	 */
-
-	public void setType(DataTypeDescriptor descriptor) throws StandardException
+    @Override
+    void setType(DataTypeDescriptor descriptor) throws StandardException
 	{
 		/* Make sure the type is nullable. */
 
@@ -181,7 +177,7 @@ public class ParameterNode extends Value
 	 * Mark this as a return output parameter (e.g.
 	 * ? = CALL myMethod())
 	 */
-	public void setReturnOutputParam(ValueNode valueNode)
+    void setReturnOutputParam(ValueNode valueNode)
 	{
 		returnOutputParameter = valueNode;
 	}
@@ -192,7 +188,7 @@ public class ParameterNode extends Value
 	 *
 	 * @return true if it is a return param
 	 */
-	public boolean isReturnOutputParam()
+    boolean isReturnOutputParam()
 	{
 		return returnOutputParameter != null;
 	}
@@ -213,10 +209,11 @@ public class ParameterNode extends Value
 	 *
 	 * @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
 	{
 		checkReliability( "?", CompilerContext.UNNAMED_PARAMETER_ILLEGAL );
 
@@ -228,13 +225,15 @@ public class ParameterNode extends Value
 	 *
 	 * @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;
 	}
@@ -251,6 +250,7 @@ public class ParameterNode extends Value
 	 *
 	 * @return	The variant type for the underlying expression.
 	 */
+    @Override
 	protected int getOrderableVariantType()
 	{
 		// Parameters are invariant for the life of the query
@@ -322,6 +322,7 @@ public class ParameterNode extends Value
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
     void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
 									throws StandardException
 	{
@@ -378,7 +379,8 @@ public class ParameterNode extends Value
         mb.cast(getTypeCompiler().interfaceName());
 	} // End of generateExpression
 
-	public TypeId getTypeId() throws StandardException
+    @Override
+    TypeId getTypeId() throws StandardException
 	{
 		return (returnOutputParameter != null) ?
 			returnOutputParameter.getTypeId() : super.getTypeId();
@@ -406,7 +408,7 @@ public class ParameterNode extends Value
 	 */
     static void generateParameterValueSet(ExpressionClassBuilder acb,
 								   int		numberOfParameters,
-								   List     parameterList)
+                                   List<ParameterNode>     parameterList)
 		throws StandardException
 	{
 		if (numberOfParameters > 0)
@@ -417,7 +419,8 @@ public class ParameterNode extends Value
 			** Check the first parameter to see if it is a return
 			** parameter.
 			*/
-			boolean hasReturnParam = ((ParameterNode)parameterList.get(0)).isReturnOutputParam();
+            boolean
+                hasReturnParam = (parameterList.get(0)).isReturnOutputParam();
 
 			/*
 			** Generate the following:
@@ -485,7 +488,8 @@ public class ParameterNode extends Value
 	/**
 	 * @see ValueNode#requiresTypeFromContext
 	 */
-	public boolean requiresTypeFromContext()
+    @Override
+    boolean requiresTypeFromContext()
 	{
 		return true;
 	}
@@ -493,7 +497,8 @@ public class ParameterNode extends Value
 	/**
 	 * @see ValueNode#isParameterNode
 	 */
-	public boolean isParameterNode()
+    @Override
+    boolean isParameterNode()
 	{
 		return true;
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParseException.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParseException.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParseException.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParseException.java Fri Jun 21 07:47:47 2013
@@ -114,6 +114,7 @@ class ParseException extends Exception {
    * of the final stack trace, and hence the correct error message
    * gets displayed.
    */
+  @Override
   public String getMessage() {
     if (!specialConstructor) {
       return super.getMessage();
@@ -169,7 +170,7 @@ class ParseException extends Exception {
    * string literal.
    */
   protected String add_escapes(String str) {
-      StringBuffer retval = new StringBuffer();
+      StringBuilder retval = new StringBuilder();
       char ch;
       for (int i = 0; i < str.length(); i++) {
         switch (str.charAt(i))
@@ -203,7 +204,8 @@ class ParseException extends Exception {
            default:
               if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
                  String s = "0000" + Integer.toString(ch, 16);
-                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+                 retval.append("\\u");
+                 retval.append(s.substring(s.length() - 4, s.length()));
               } else {
                  retval.append(ch);
               }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParserImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParserImpl.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParserImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParserImpl.java Fri Jun 21 07:47:47 2013
@@ -21,13 +21,12 @@
 
 package org.apache.derby.impl.sql.compile;
 
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
 import org.apache.derby.iapi.sql.compile.Parser;
 import org.apache.derby.iapi.sql.compile.Visitable;
 
-import org.apache.derby.iapi.reference.SQLState;
-import org.apache.derby.iapi.error.StandardException;
-
 public class ParserImpl implements Parser
 {
 	/*
@@ -101,7 +100,7 @@ public class ParserImpl implements Parse
         {
 	    SQLParserTokenManager tm = (SQLParserTokenManager) getTokenManager();
 	    /* returned a cached Parser if already exists, otherwise create */
-	    SQLParser p = (SQLParser) cachedParser;
+        SQLParser p = cachedParser;
 	    if (p == null) {
 		p = new SQLParser(tm);
 		p.setCompilerContext(cc);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/Predicate.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/Predicate.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/Predicate.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/Predicate.java Fri Jun 21 07:47:47 2013
@@ -23,33 +23,26 @@ package	org.apache.derby.impl.sql.compil
 
 import java.util.HashSet;
 import java.util.Set;
-
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-import org.apache.derby.iapi.sql.compile.Visitor;
-import org.apache.derby.iapi.sql.compile.OptimizablePredicate;
-import org.apache.derby.iapi.sql.compile.Optimizable;
-
-import org.apache.derby.iapi.store.access.ScanController;
-
 import org.apache.derby.iapi.error.StandardException;
-
 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.Optimizable;
+import org.apache.derby.iapi.sql.compile.OptimizablePredicate;
+import org.apache.derby.iapi.sql.compile.Visitor;
+import org.apache.derby.iapi.store.access.ScanController;
 import org.apache.derby.iapi.types.DataValueDescriptor;
-
 import org.apache.derby.iapi.util.JBitSet;
 import org.apache.derby.iapi.util.ReuseFactory;
 
-
 /**
  * A Predicate represents a top level predicate.
  *
  */
 
 public final class Predicate extends QueryTreeNode implements OptimizablePredicate,
-														Comparable
+                                                        Comparable<Predicate>
 {
 	/* Top of the predicate */
 	AndNode		andNode;
@@ -75,17 +68,20 @@ public final class Predicate extends Que
 	private boolean scoped;
 
 	/**
-	 * Initializer.
+     * Constructor.
 	 *
 	 * @param andNode		The top of the predicate	 
 	 * @param referencedSet	Bit map of referenced tables
+     * @param cm            The context manager
 	 */
 
-	public void init(Object andNode, Object referencedSet)
+    Predicate(AndNode andNode, JBitSet referencedSet, ContextManager cm)
 	{
-		this.andNode = (AndNode) andNode;
+        super(cm);
+        setNodeType(C_NodeTypes.PREDICATE);
+        this.andNode = andNode;
 		pushable = false;
-		this.referencedSet = (JBitSet) referencedSet;
+        this.referencedSet = referencedSet;
 		scoped = false;
 	}
 
@@ -258,9 +254,9 @@ public final class Predicate extends Que
 
 	/* Comparable interface */
 
-	public int compareTo(Object other)
+    public int compareTo(Predicate other)
 	{
-		Predicate	otherPred = (Predicate) other;
+        Predicate otherPred = other;
 
 		/* Not all operators are "equal". If the predicates are on the
 		 * same key column, then a "=" opertor takes precedence over all
@@ -345,7 +341,7 @@ public final class Predicate extends Que
 	 *
 	 * @return AndNode	The andNode.
 	 */
-	public AndNode getAndNode()
+    AndNode getAndNode()
 	{
 		return andNode;
 	}
@@ -355,7 +351,7 @@ public final class Predicate extends Que
 	 *
 	 * @param andNode	The new andNode.
 	 */
-	public void setAndNode(AndNode andNode)
+    void setAndNode(AndNode andNode)
 	{
 		this.andNode = andNode;
 	}
@@ -365,7 +361,7 @@ public final class Predicate extends Que
 	 *
 	 * @return boolean	Whether or not the predicate is pushable.
 	 */
-	public boolean getPushable()
+    boolean getPushable()
 	{
 		return pushable;
 	}
@@ -380,7 +376,7 @@ public final class Predicate extends Que
 	 *
 	 * @param pushable Whether or not the predicate is pushable.
 	 */
-	public void setPushable(boolean pushable) {
+    void setPushable(boolean pushable) {
 		this.pushable = pushable;
 	}
 
@@ -389,7 +385,7 @@ public final class Predicate extends Que
 	 *
 	 * @return JBitSet	The referencedSet.
 	 */
-	public JBitSet getReferencedSet()
+    JBitSet getReferencedSet()
 	{
 		return referencedSet;
 	}
@@ -420,7 +416,7 @@ public final class Predicate extends Que
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void categorize() throws StandardException
+    void categorize() throws StandardException
 	{
 		pushable = andNode.categorize(referencedSet, false);
 	}
@@ -433,7 +429,7 @@ public final class Predicate extends Que
 	 * @return	The RelationalOperator on the left side of the AND node,
 	 *			if any.
 	 */
-	public RelationalOperator getRelop()
+    RelationalOperator getRelop()
 	{
 		
 		if (andNode.getLeftOperand() instanceof RelationalOperator)
@@ -446,7 +442,7 @@ public final class Predicate extends Que
 		}
 	}
 
-	public final boolean isOrList()
+    final boolean isOrList()
     {
         return(andNode.getLeftOperand() instanceof OrNode);
     }
@@ -472,7 +468,7 @@ public final class Predicate extends Que
      *
 	 * @exception  StandardException  Standard exception policy.
      **/
-	public final boolean isStoreQualifier()
+    final boolean isStoreQualifier()
     {
 		if ((andNode.getLeftOperand() instanceof RelationalOperator) ||
 		    (andNode.getLeftOperand() instanceof OrNode))
@@ -498,7 +494,7 @@ public final class Predicate extends Que
      *
 	 * @exception  StandardException  Standard exception policy.
      **/
-	public final boolean isPushableOrClause(Optimizable optTable)
+    final boolean isPushableOrClause(Optimizable optTable)
         throws StandardException
 	{
         boolean ret_val = true;
@@ -711,7 +707,7 @@ public final class Predicate extends Que
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
@@ -736,7 +732,7 @@ public final class Predicate extends Que
 	 * is referencing, especially when tracing through code and printing
 	 * assert failure.
 	 */
-	public String binaryRelOpColRefsToString()
+    String binaryRelOpColRefsToString()
 	{
 		// We only consider binary relational operators here.
 		if (!(getAndNode().getLeftOperand()
@@ -746,7 +742,7 @@ public final class Predicate extends Que
 		}
 
 		final String DUMMY_VAL = "<expr>";
-		java.lang.StringBuffer sBuf = new java.lang.StringBuffer();
+        java.lang.StringBuilder sBuf = new java.lang.StringBuilder();
 		BinaryRelationalOperatorNode opNode =
 			(BinaryRelationalOperatorNode)getAndNode().getLeftOperand();
 
@@ -785,8 +781,8 @@ public final class Predicate extends Que
 	 *
 	 * @param depth		The depth of this node in the tree
 	 */
-
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -803,6 +799,7 @@ public final class Predicate extends Que
 	 *
 	 * @exception StandardException on error
 	 */
+    @Override
 	void acceptChildren(Visitor v)
 		throws StandardException
 	{
@@ -820,7 +817,7 @@ public final class Predicate extends Que
 	 *
 	 */
 
-	public void copyFields(Predicate otherPred) {
+    void copyFields(Predicate otherPred) {
 
 		this.equivalenceClass = otherPred.getEquivalenceClass();
 		this.indexPosition = otherPred.getIndexPosition();
@@ -971,10 +968,7 @@ public final class Predicate extends Que
 		// need to create an AndNode representing:
 		//    <scoped_bin_rel_op> AND TRUE
 		// First create the boolean constant for TRUE.
-		ValueNode trueNode = (ValueNode) getNodeFactory().getNode(
-			C_NodeTypes.BOOLEAN_CONSTANT_NODE,
-			Boolean.TRUE,
-			getContextManager());
+        ValueNode trueNode = new BooleanConstantNode(true, getContextManager());
 
 		BinaryRelationalOperatorNode opNode =
 			(BinaryRelationalOperatorNode)getAndNode().getLeftOperand();
@@ -982,7 +976,7 @@ public final class Predicate extends Que
 		// Create a new op node with left and right operands that point
 		// to the received result set's columns as appropriate.
 		BinaryRelationalOperatorNode newOpNode = 
-			(BinaryRelationalOperatorNode) getNodeFactory().getNode(
+            new BinaryRelationalOperatorNode(
 				opNode.getNodeType(),
 				opNode.getScopedOperand(
 					BinaryRelationalOperatorNode.LEFT,
@@ -994,7 +988,7 @@ public final class Predicate extends Que
 					parentRSNsTables,
 					childRSN,
 					whichRC),
-					Boolean.valueOf(opNode.getForQueryRewrite()),
+                opNode.getForQueryRewrite(),
 				getContextManager());
 
 		// Bind the new op node.
@@ -1002,11 +996,7 @@ public final class Predicate extends Que
 
 		// Create and bind a new AND node in CNF form,
 		// i.e. "<newOpNode> AND TRUE".
-		AndNode newAnd = (AndNode) getNodeFactory().getNode(
-			C_NodeTypes.AND_NODE,
-			newOpNode,
-			trueNode,
-			getContextManager());
+        AndNode newAnd = new AndNode(newOpNode, trueNode, getContextManager());
 		newAnd.postBindFixup();
 
 		// Categorize the new AND node; among other things, this
@@ -1018,11 +1008,8 @@ public final class Predicate extends Que
 		newAnd.categorize(tableMap, false);
 
 		// Now put the pieces together to get a new predicate.
-		Predicate newPred = (Predicate) getNodeFactory().getNode(
-			C_NodeTypes.PREDICATE,
-			newAnd,
-			tableMap,
-			getContextManager());
+        Predicate newPred =
+                new Predicate(newAnd, tableMap, getContextManager());
 
 		// Copy all of this predicates other fields into the new predicate.
 		newPred.clearScanFlags();
@@ -1135,7 +1122,7 @@ public final class Predicate extends Que
 		BinaryRelationalOperatorNode binRelOp =
 			(BinaryRelationalOperatorNode)andNode.getLeftOperand();
 
-		ValueNode operand = null;
+        ValueNode operand;
 
 		if (SanityManager.DEBUG)
 		{
@@ -1253,7 +1240,7 @@ public final class Predicate extends Que
 		 * to a source result set further down the tree and
 		 * thus we return true.
 		 */
-		ValueNode exp = null;
+        ValueNode exp;
 		ColumnReference cRef = (ColumnReference)operand;
 		if (cRef.isScoped())
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java Fri Jun 21 07:47:47 2013
@@ -21,45 +21,32 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
-import org.apache.derby.iapi.services.compiler.LocalField;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+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.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.AccessPath;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
 import org.apache.derby.iapi.sql.compile.ExpressionClassBuilderInterface;
+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.Optimizable;
 import org.apache.derby.iapi.sql.compile.RequiredRowOrdering;
 import org.apache.derby.iapi.sql.compile.RowOrdering;
-import org.apache.derby.iapi.sql.compile.AccessPath;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-
-import org.apache.derby.iapi.sql.execute.ExecutionFactory;
-
-
 import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
-import org.apache.derby.iapi.types.DataValueDescriptor;
-
+import org.apache.derby.iapi.sql.execute.ExecutionFactory;
 import org.apache.derby.iapi.store.access.ScanController;
-
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
+import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.util.JBitSet;
 
-import java.lang.reflect.Modifier;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * A PredicateList represents the list of top level predicates.
  * Each top level predicate consists of an AndNode whose leftOperand is the
@@ -68,16 +55,20 @@ import java.util.List;
  *
  */
 
-public class PredicateList extends QueryTreeNodeVector implements OptimizablePredicateList
+class PredicateList extends QueryTreeNodeVector
+                    implements OptimizablePredicateList
 {
 	private int	numberOfStartPredicates;
 	private int numberOfStopPredicates;
 	private int numberOfQualifiers;
 
-	public PredicateList()
+    PredicateList(ContextManager cm)
 	{
+        super(cm);
+        setNodeType(C_NodeTypes.PREDICATE_LIST);
 	}
 
+
 	/*
 	 * OptimizableList interface
 	 */
@@ -321,7 +312,7 @@ public class PredicateList extends Query
 													  boolean isNullOkay)
 							throws StandardException
 	{
-		ValueNode opNode = null;
+        ValueNode opNode;
 		int size = size();
 		for (int index = 0; index < size; index++)
 		{
@@ -334,7 +325,7 @@ public class PredicateList extends Query
 				continue;
 			}
 
-			andNode = (AndNode) predicate.getAndNode();
+            andNode = predicate.getAndNode();
 
 			// skip non-equality predicates
 			opNode = andNode.getLeftOperand();
@@ -367,7 +358,7 @@ public class PredicateList extends Query
 			Predicate		predicate;
 			predicate = (Predicate) elementAt(index);
 
-			andNode = (AndNode) predicate.getAndNode();
+            andNode = predicate.getAndNode();
 
 			// skip non-equality predicates
 			ValueNode opNode = andNode.getLeftOperand();
@@ -413,7 +404,7 @@ public class PredicateList extends Query
 				continue;
 			}
 
-			andNode = (AndNode) predicate.getAndNode();
+            andNode = predicate.getAndNode();
 
 			ValueNode opNode = andNode.getLeftOperand();
 
@@ -463,7 +454,7 @@ public class PredicateList extends Query
 			Predicate		predicate = (Predicate) elementAt(index);
 			AndNode			andNode;
 
-			andNode = (AndNode) predicate.getAndNode();
+            andNode = predicate.getAndNode();
 
 			// skip non-equality predicates
 			ValueNode opNode = andNode.getLeftOperand();
@@ -959,14 +950,12 @@ public class PredicateList extends Query
 				Predicate predToPush;
 				if (isIn && !thisPred.isInListProbePredicate())
                 {
-					AndNode andCopy = (AndNode) getNodeFactory().getNode(
-										C_NodeTypes.AND_NODE,
+                   AndNode andCopy = new AndNode(
 										thisPred.getAndNode().getLeftOperand(),
 										thisPred.getAndNode().getRightOperand(),
 										getContextManager());
 					andCopy.copyFields(thisPred.getAndNode());
-					Predicate predCopy = (Predicate) getNodeFactory().getNode(
-										C_NodeTypes.PREDICATE,
+                    Predicate predCopy = new Predicate(
 										andCopy,
 										thisPred.getReferencedSet(),
 										getContextManager());
@@ -1016,7 +1005,7 @@ public class PredicateList extends Query
 	 * @exception StandardException		Thrown on error
 	 */
 
-	public void addPredicate(Predicate predicate) throws StandardException
+    void addPredicate(Predicate predicate) throws StandardException
 	{
 		if (predicate.isStartKey())
 			numberOfStartPredicates++;
@@ -1070,7 +1059,7 @@ public class PredicateList extends Query
 	 *
 	 * @exception StandardException			Thrown on error
 	 */
-	public void categorize()
+    void categorize()
 		throws StandardException
 	{
 		int size = size();
@@ -1091,7 +1080,7 @@ public class PredicateList extends Query
 	 *  Like transformation on c1 like 'ASDF%' can leave
 	 *  one of these predicates in the list.
 	 */
-	public void eliminateBooleanTrueAndBooleanTrue()
+    void eliminateBooleanTrueAndBooleanTrue()
 	{
 		/* Walk list backwards since we can delete while
 		 * traversing the list.
@@ -1137,7 +1126,7 @@ public class PredicateList extends Query
 	 *
 	 * @return ValueNode	The rebuilt expression tree.
 	 */
-	public ValueNode restoreConstantPredicates()
+    ValueNode restoreConstantPredicates()
 	throws StandardException
 	{
 		AndNode			nextAnd;
@@ -1234,7 +1223,7 @@ public class PredicateList extends Query
 	 *
 	 * @return ValueNode	The rebuilt expression tree.
 	 */
-	public ValueNode restorePredicates()
+    ValueNode restorePredicates()
 	throws StandardException
 	{
 		AndNode			nextAnd;
@@ -1302,7 +1291,7 @@ public class PredicateList extends Query
 	 *
 	 * @exception StandardException			Thrown on error
 	 */
-	public void remapColumnReferencesToExpressions() throws StandardException
+    void remapColumnReferencesToExpressions() throws StandardException
 	{
 		Predicate		pred;
 
@@ -1338,16 +1327,12 @@ public class PredicateList extends Query
 		AndNode		topAnd;
 		JBitSet		newJBitSet;
 		Predicate	newPred;
-		BooleanConstantNode	trueNode = null;
 
 		if (searchClause != null)
 		{
 			topAnd = (AndNode) searchClause;
-			searchClause = null;
-			trueNode = (BooleanConstantNode) getNodeFactory().getNode(
-											C_NodeTypes.BOOLEAN_CONSTANT_NODE,
-											Boolean.TRUE,
-											getContextManager());
+            BooleanConstantNode trueNode =
+                    new BooleanConstantNode(true, getContextManager());
 			
 			while (topAnd.getRightOperand() instanceof AndNode)
 			{
@@ -1361,21 +1346,14 @@ public class PredicateList extends Query
 
 				/* Add the top AndNode to the PredicateList */
 				newJBitSet = new JBitSet(numTables);
-				newPred = (Predicate) getNodeFactory().getNode(
-											C_NodeTypes.PREDICATE,
-											thisAnd,
-											newJBitSet,
-											getContextManager());
+                newPred =
+                    new Predicate(thisAnd, newJBitSet, getContextManager());
 				addPredicate(newPred);
 			}
 			
 			/* Add the last top AndNode to the PredicateList */
 			newJBitSet = new JBitSet(numTables);
-			newPred = (Predicate) getNodeFactory().getNode(
-											C_NodeTypes.PREDICATE,
-											topAnd,
-											newJBitSet,
-											getContextManager());
+            newPred = new Predicate(topAnd, newJBitSet, getContextManager());
 			addPredicate(newPred);
 		}
 	}
@@ -1387,7 +1365,7 @@ public class PredicateList extends Query
 	 * 
 	 * @param fromMap	The JBitSet to XOR with.
 	 */
-	public void xorReferencedSet(JBitSet fromMap)
+    void xorReferencedSet(JBitSet fromMap)
 	{
 		Predicate		predicate;
 
@@ -1563,22 +1541,20 @@ public class PredicateList extends Query
 						inNode.setLeftOperand(newCRNode);
 					}
 
-					BinaryRelationalOperatorNode newRelop = (BinaryRelationalOperatorNode)
-							getNodeFactory().getNode(
+                    BinaryRelationalOperatorNode newRelop =
+                            new BinaryRelationalOperatorNode(
 										opNode.getNodeType(),
 										newCRNode,
 										opNode.getRightOperand(),
 										inNode,
-										Boolean.valueOf(opNode.getForQueryRewrite()),
+                                        opNode.getForQueryRewrite(),
 										getContextManager());
 					newRelop.bindComparisonOperator();
 					leftOperand = newRelop;
 				}
 				else
 				{
-					InListOperatorNode newInNode = (InListOperatorNode)
-							getNodeFactory().getNode(
-								C_NodeTypes.IN_LIST_OPERATOR_NODE,
+                    InListOperatorNode newInNode = new InListOperatorNode(
 								newCRNode,
 								inNode.getRightOperandList(),
 								getContextManager());
@@ -1586,25 +1562,22 @@ public class PredicateList extends Query
 					leftOperand = newInNode;
 				}
 
-				// Convert the predicate into CNF form
-				ValueNode trueNode = (ValueNode) getNodeFactory().getNode(
-										C_NodeTypes.BOOLEAN_CONSTANT_NODE,
-										Boolean.TRUE,
-										getContextManager());
-				AndNode newAnd = (AndNode) getNodeFactory().getNode(
-													C_NodeTypes.AND_NODE,
-													leftOperand,
-													trueNode,
-													getContextManager());
+               // Convert the predicate into CNF form:
+                //
+                //              AND
+                //             /   \
+                //    leftOperand  true
+                //
+               ValueNode trueNode =
+                        new BooleanConstantNode(true, getContextManager());
+                AndNode newAnd =
+                        new AndNode(leftOperand, trueNode, getContextManager());
 				newAnd.postBindFixup();
 				JBitSet tableMap = new JBitSet(select.referencedTableMap.size());
 
 				// Use newly constructed predicate
-				predicate = (Predicate) getNodeFactory().getNode(
-												C_NodeTypes.PREDICATE,
-												newAnd,
-												tableMap,
-												getContextManager());
+                predicate =
+                    new Predicate(newAnd, tableMap, getContextManager());
 			}
 			else
 			{
@@ -1690,7 +1663,7 @@ public class PredicateList extends Query
 		int size = size();
 		for (int index = 0; index < size; index++)
 		{
-			AndNode and = (AndNode) ((Predicate) elementAt(index)).getAndNode();
+            AndNode and = ((Predicate) elementAt(index)).getAndNode();
 			and.checkTopPredicatesForEqualsConditions(
 				tableNumber, eqOuterCols, tableNumbers, tableColMap,
 				resultColTable);
@@ -1769,9 +1742,7 @@ public class PredicateList extends Query
 				/* Add the matching predicate to the push list */
 				if (pushPList == null)
 				{
-					pushPList = (PredicateList) getNodeFactory().getNode(
-											C_NodeTypes.PREDICATE_LIST,
-											getContextManager());
+                    pushPList = new PredicateList(getContextManager());
 				}
 				pushPList.addPredicate(predicate);
 
@@ -1905,7 +1876,7 @@ public class PredicateList extends Query
 		PredicateList[] joinClauses = new PredicateList[numTables];
 		for (int index = 0; index < numTables; index++)
 		{
-			joinClauses[index] = new PredicateList();
+            joinClauses[index] = new PredicateList(getContextManager());
 		}
 
 		/* Pull the equijoin clauses, putting each one in the list for
@@ -1974,15 +1945,14 @@ public class PredicateList extends Query
 			}
 			for (int mpIndex = 0; mpIndex < movePreds.size(); mpIndex++)
 			{
-				outerJCL.insertElementAt(
-                    (Predicate) movePreds.get(mpIndex), 0);
+                outerJCL.insertElementAt(movePreds.get(mpIndex), 0);
 			}
 
 			// Walk this list as the outer
 			for (int outerIndex = 0; outerIndex < outerJCL.size(); outerIndex++)
 			{
 				ColumnReference innerCR = null;
-				ColumnReference outerCR = null;
+                ColumnReference outerCR;
 				int outerTableNumber = index;
 				int middleTableNumber;
 				int outerColumnNumber;
@@ -2151,33 +2121,32 @@ public class PredicateList extends Query
 
 					// No match, add new equijoin
 					// Build a new predicate
-					BinaryRelationalOperatorNode newEquals = (BinaryRelationalOperatorNode)
-							getNodeFactory().getNode(
+                    BinaryRelationalOperatorNode newEquals =
+                            new BinaryRelationalOperatorNode(
 										C_NodeTypes.BINARY_EQUALS_OPERATOR_NODE,
 										outerCR.getClone(),
 										innerCR.getClone(),
-										Boolean.FALSE,
+                                        false,
 										getContextManager());
 					newEquals.bindComparisonOperator();
-					/* Create the AND */
-			        ValueNode trueNode = (ValueNode) getNodeFactory().getNode(
-											C_NodeTypes.BOOLEAN_CONSTANT_NODE,
-											Boolean.TRUE,
-											getContextManager());
-					AndNode newAnd = (AndNode) getNodeFactory().getNode(
-														C_NodeTypes.AND_NODE,
-														newEquals,
-														trueNode,
-														getContextManager());
+
+                   // Create new predicate into CNF:
+                    //
+                    //              AND
+                    //             /   \
+                    //    newEquals    true
+                    //
+                   ValueNode trueNode =
+                            new BooleanConstantNode(true, getContextManager());
+                    AndNode newAnd =
+                        new AndNode(newEquals, trueNode, getContextManager());
 					newAnd.postBindFixup();
+
 					// Add a new predicate to both the equijoin clauses and this list
 					JBitSet tableMap = new JBitSet(numTables);
 					newAnd.categorize(tableMap, false);
-					Predicate newPred = (Predicate) getNodeFactory().getNode(
-													C_NodeTypes.PREDICATE,
-													newAnd,
-													tableMap,
-													getContextManager());
+                    Predicate newPred =
+                        new Predicate(newAnd, tableMap, getContextManager());
 					newPred.setEquivalenceClass(outerEC);
 					addPredicate(newPred);
 					/* Add the new predicate right after the outer position
@@ -2231,8 +2200,8 @@ public class PredicateList extends Query
 	 void searchClauseTransitiveClosure(int numTables, boolean hashJoinSpecified)
 		 throws StandardException
 	 {
-		PredicateList	equijoinClauses = new PredicateList();
-		PredicateList	searchClauses = new PredicateList();
+        PredicateList equijoinClauses = new PredicateList(getContextManager());
+        PredicateList searchClauses = new PredicateList(getContextManager());
 		RelationalOperator	equalsNode = null;
 
 		int size = size();
@@ -2317,8 +2286,8 @@ public class PredicateList extends Query
 			ColumnReference searchCR;
 			DataValueDescriptor searchODV = null;
 			RelationalOperator ro = (RelationalOperator)
-										((AndNode) 
-											((Predicate) searchClauses.elementAt(scIndex)).getAndNode()).getLeftOperand();
+                    (((Predicate) searchClauses.elementAt(scIndex)).
+                    getAndNode()).getLeftOperand();
 
 			// Find the ColumnReference and constant value, if any, in the search clause
 			if (ro instanceof UnaryComparisonOperatorNode)
@@ -2333,7 +2302,7 @@ public class PredicateList extends Query
 				if (((BinaryComparisonOperatorNode) ro).getRightOperand() instanceof ConstantNode)
 				{
 					ConstantNode currCN = (ConstantNode) ((BinaryComparisonOperatorNode) ro).getRightOperand();
-					searchODV = (DataValueDescriptor) currCN.getValue();
+                    searchODV = currCN.getValue();
 				}
 				else searchODV = null;
 			}
@@ -2359,8 +2328,7 @@ public class PredicateList extends Query
 				}
 
 				BinaryRelationalOperatorNode equals = (BinaryRelationalOperatorNode)
-													((AndNode)
-														predicate.getAndNode()).getLeftOperand();
+                        predicate.getAndNode().getLeftOperand();
 				ColumnReference leftCR = (ColumnReference) equals.getLeftOperand();
 				ColumnReference rightCR = (ColumnReference) equals.getRightOperand();
 				ColumnReference otherCR;
@@ -2391,15 +2359,14 @@ public class PredicateList extends Query
 				predicate.setTransitiveSearchClauseAdded(ro);
 
 				boolean match = false;
-				ColumnReference searchCR2 = null;
-				RelationalOperator ro2 = null;
+                ColumnReference searchCR2;
+                RelationalOperator ro2;
 				int scSize = searchClauses.size();
 				for (int scIndex2 = 0; scIndex2 < scSize; scIndex2++)
 				{
 					DataValueDescriptor currODV = null;
-					ro2 = (RelationalOperator)
-							((AndNode) 
-								((Predicate) searchClauses.elementAt(scIndex2)).getAndNode()).getLeftOperand();
+                    ro2 = (RelationalOperator)(((Predicate) searchClauses.
+                            elementAt(scIndex2)).getAndNode()).getLeftOperand();
 
 					// Find the ColumnReference in the search clause
 					if (ro2 instanceof UnaryComparisonOperatorNode)
@@ -2412,7 +2379,7 @@ public class PredicateList extends Query
 						if (((BinaryComparisonOperatorNode) ro2).getRightOperand() instanceof ConstantNode)
 						{
 							ConstantNode currCN = (ConstantNode) ((BinaryComparisonOperatorNode) ro2).getRightOperand();
-							currODV = (DataValueDescriptor) currCN.getValue();
+                            currODV = currCN.getValue();
 						}
 						else currODV = null;
 					}
@@ -2437,8 +2404,9 @@ public class PredicateList extends Query
 				if (! match)
 				{
 					// Build a new predicate
-					RelationalOperator roClone = ro.getTransitiveSearchClause((ColumnReference) otherCR.getClone());
-
+                    OperatorNode roClone =
+                        (OperatorNode)ro.getTransitiveSearchClause(
+                            (ColumnReference)otherCR.getClone());
 					/* Set type info for the operator node */
 					if (roClone instanceof BinaryComparisonOperatorNode)
 					{
@@ -2449,25 +2417,23 @@ public class PredicateList extends Query
 						((UnaryComparisonOperatorNode) roClone).bindComparisonOperator();
 					}
 
-					/* Create the AND */
-			        ValueNode trueNode = (ValueNode) getNodeFactory().getNode(
-											C_NodeTypes.BOOLEAN_CONSTANT_NODE,
-											Boolean.TRUE,
-											getContextManager());
-					AndNode newAnd = (AndNode) getNodeFactory().getNode(
-														C_NodeTypes.AND_NODE,
-														roClone,
-														trueNode,
-														getContextManager());
+                   // Convert the roClone into CNF:
+                    //
+                    //              AND
+                    //             /   \
+                    //       roClone    true
+                    //
+                   ValueNode trueNode =
+                            new BooleanConstantNode(true, getContextManager());
+                    AndNode newAnd =
+                            new AndNode(roClone, trueNode, getContextManager());
 					newAnd.postBindFixup();
+
 					// Add a new predicate to both the search clauses and this list
 					JBitSet tableMap = new JBitSet(numTables);
 					newAnd.categorize(tableMap, false);
-					Predicate newPred = (Predicate) getNodeFactory().getNode(
-														C_NodeTypes.PREDICATE,
-														newAnd,
-														tableMap,
-														getContextManager());
+                    Predicate newPred =
+                        new Predicate(newAnd, tableMap, getContextManager());
 					addPredicate(newPred);
 					searchClauses.addElement(newPred);
 				}
@@ -3104,7 +3070,7 @@ public class PredicateList extends Query
 
         /* Assign the initializer to the Qualifier[] field */
         consMB.pushNewArray(
-            ClassName.Qualifier + "[]", (int) num_of_or_conjunctions + 1);
+            ClassName.Qualifier + "[]", num_of_or_conjunctions + 1);
         consMB.setField(qualField);
 
         // Allocate qualifiers[0] which is an entry for each of the leading
@@ -3303,7 +3269,7 @@ public class PredicateList extends Query
         PredicateList[] sortList = new PredicateList[QUALIFIER_NUM_CATEGORIES];
 
         for (int i = sortList.length - 1; i >= 0; i--)
-            sortList[i] = new PredicateList();
+            sortList[i] = new PredicateList(getContextManager());
 
 		int predIndex;
 		int size = size();
@@ -3777,7 +3743,8 @@ public class PredicateList extends Query
 		 * list; we'll work with the workingPredicates list from now on in this
 		 * routine. 
 		 */
-		PredicateList workingPredicates = new PredicateList();
+        PredicateList workingPredicates =
+            new PredicateList(getContextManager());
 
 		for (int i = 0; i < numPredicates; i++)
 		{
@@ -3907,7 +3874,7 @@ public class PredicateList extends Query
 				/* remove the predicates that we've calculated the selectivity
 				 * of, from workingPredicates.
 				 */
-				Predicate p =(Predicate) maxPreds.get(i);
+                Predicate p = maxPreds.get(i);
 				workingPredicates.removeOptPredicate(p);
 			}	
 			
@@ -4007,7 +3974,7 @@ public class PredicateList extends Query
 		 * [p2] shuld be considered again later.
 		*/
 		PredicateWrapperList pwl = predArray[position];
-		List uniquepreds = pwl.createLeadingUnique();
+        List<PredicateWrapper> uniquepreds = pwl.createLeadingUnique();
 		
         /* uniqueprds is a list of predicates (along with wrapper) that I'm
 		   going  to use to get statistics from-- we now have to delete these
@@ -4015,8 +3982,7 @@ public class PredicateList extends Query
 		*/
 		for (int i = 0; i < uniquepreds.size(); i++)
 		{
-			Predicate p = 
-				((PredicateWrapper)uniquepreds.get(i)).getPredicate();
+            Predicate p = uniquepreds.get(i).getPredicate();
 			ret.add(p);
 			for (int j = 0; j < predArray.length; j++)
 			{
@@ -4058,7 +4024,7 @@ public class PredicateList extends Query
 		for (int i = 0; i < size(); i++)
 		{
 			OptimizablePredicate pred = (OptimizablePredicate)elementAt(i);
-			selectivity *= pred.selectivity((Optimizable)optTable);
+            selectivity *= pred.selectivity(optTable);
 		}
 		
 		return selectivity;
@@ -4073,7 +4039,7 @@ public class PredicateList extends Query
 	 * being considered in estimateCost. For us, each predicate can have
 	 * different index positions for different indices. 
 	 */
-	private class PredicateWrapper 
+    private static class PredicateWrapper
 	{
 		int indexPosition;
 		Predicate pred;
@@ -4112,7 +4078,7 @@ public class PredicateList extends Query
 	
 	/** Another inner class which is basically a List of Predicate Wrappers.
 	 */
-	private class PredicateWrapperList
+    private static class PredicateWrapperList
 	{
 		private final ArrayList<PredicateWrapper> pwList;
 		int numPreds;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java Fri Jun 21 07:47:47 2013
@@ -21,28 +21,28 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import java.util.HashMap;
+import java.util.List;
+import org.apache.derby.catalog.AliasInfo;
+import org.apache.derby.catalog.TypeDescriptor;
+import org.apache.derby.catalog.types.RoutineAliasInfo;
 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.depend.Provider;
-import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
-import org.apache.derby.iapi.sql.dictionary.DataDictionary;
-import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;
 import org.apache.derby.iapi.sql.dictionary.PrivilegedSQLObject;
-import org.apache.derby.catalog.types.RoutineAliasInfo;
-import org.apache.derby.catalog.AliasInfo;
-import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
+import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.impl.sql.execute.GenericPrivilegeInfo;
 import org.apache.derby.impl.sql.execute.PrivilegeInfo;
-import org.apache.derby.catalog.TypeDescriptor;
-
-import java.util.HashMap;
-import java.util.List;
 
 /**
  * This node represents a set of privileges that are granted or revoked on one object.
  */
-public class PrivilegeNode extends QueryTreeNode
+class PrivilegeNode extends QueryTreeNode
 {
     // Privilege object type
     public static final int TABLE_PRIVILEGES = 0;
@@ -70,19 +70,25 @@ public class PrivilegeNode extends Query
     /**
      * Initialize a PrivilegeNode for use against SYS.SYSTABLEPERMS and SYS.SYSROUTINEPERMS.
      *
-     * @param objectType (an Integer)
-     * @param objectOfPrivilege (a TableName or RoutineDesignator)
+     * @param objectType
+     * @param objectOfPrivilege  (a TableName or RoutineDesignator)
      * @param specificPrivileges null for routines and usage
+     * @param cm                 the context manager
      */
-    public void init( Object objectType, Object objectOfPrivilege, Object specificPrivileges)
-        throws StandardException
-    {
-        this.objectType = ((Integer) objectType).intValue();
-        if( SanityManager.DEBUG)
+    PrivilegeNode(int                 objectType,
+                  Object              objectOfPrivilege,
+                  TablePrivilegesNode specificPrivileges,
+                  ContextManager      cm) throws StandardException {
+        super(cm);
+        setNodeType(C_NodeTypes.PRIVILEGE_NODE);
+        this.objectType = objectType;
+
+        if ( SanityManager.DEBUG)
         {
             SanityManager.ASSERT( objectOfPrivilege != null,
                                   "null privilge object");
         }
+
         switch( this.objectType)
         {
         case TABLE_PRIVILEGES:
@@ -92,7 +98,7 @@ public class PrivilegeNode extends Query
                                       "null specific privileges used with table privilege");
             }
             objectName = (TableName) objectOfPrivilege;
-            this.specificPrivileges = (TablePrivilegesNode) specificPrivileges;
+            this.specificPrivileges = specificPrivileges;
             break;
             
         case ROUTINE_PRIVILEGES:
@@ -111,19 +117,27 @@ public class PrivilegeNode extends Query
     }
 
     /**
-     * Initialize a PrivilegeNode for use against SYS.SYSPERMS.
+     * Constructor a PrivilegeNode for use against SYS.SYSPERMS.
      *
      * @param objectType E.g., SEQUENCE
      * @param objectName A possibles schema-qualified name
-     * @param privilege A PermDescriptor privilege, e.g. PermDescriptor.USAGE_PRIV
-     * @param restrict True if this is a REVOKE...RESTRICT action
+     * @param privilege  A PermDescriptor privilege, e.g.
+     *                   {@code PermDescriptor.USAGE_PRIV}
+     * @param restrict   True if this is a REVOKE...RESTRICT action
+     * @param cm         The context manager
      */
-    public void init( Object objectType, Object objectName, Object privilege, Object restrict )
+    PrivilegeNode(int            objectType,
+                  TableName      objectName,
+                  String         privilege,
+                  boolean        restrict,
+                  ContextManager cm)
     {
-        this.objectType = ((Integer) objectType).intValue();
-        this.objectName = (TableName) objectName;
-        this.privilege = (String) privilege;
-        this.restrict = ((Boolean) restrict).booleanValue();
+        super(cm);
+        setNodeType(C_NodeTypes.PRIVILEGE_NODE);
+        this.objectType = objectType;
+        this.objectName = objectName;
+        this.privilege = privilege;
+        this.restrict = restrict;
     }
     
     /**
@@ -139,7 +153,10 @@ public class PrivilegeNode extends Query
      *
      * @exception StandardException	Standard error policy.
      */
-	public QueryTreeNode bind( HashMap<Provider,Provider> dependencies, List grantees, boolean isGrant ) throws StandardException
+    public QueryTreeNode bind(
+            HashMap<Provider,Provider> dependencies,
+            List<String> grantees,
+            boolean isGrant ) throws StandardException
 	{
         // The below code handles the case where objectName.getSchemaName()
         // returns null, in which case we'll fetch the schema descriptor for
@@ -194,11 +211,12 @@ public class PrivilegeNode extends Query
             }
 				
             AliasDescriptor proc = null;
-            RoutineAliasInfo routineInfo = null;
-            java.util.List list = getDataDictionary().getRoutineList(
-                sd.getUUID().toString(), objectName.getTableName(),
-                routineDesignator.isFunction ? AliasInfo.ALIAS_NAME_SPACE_FUNCTION_AS_CHAR : AliasInfo.ALIAS_NAME_SPACE_PROCEDURE_AS_CHAR
-                );
+            List<AliasDescriptor> list = getDataDictionary().getRoutineList(
+                sd.getUUID().toString(),
+                objectName.getTableName(),
+                routineDesignator.isFunction ?
+                    AliasInfo.ALIAS_NAME_SPACE_FUNCTION_AS_CHAR :
+                    AliasInfo.ALIAS_NAME_SPACE_PROCEDURE_AS_CHAR);
 
             if( routineDesignator.paramTypeList == null)
             {
@@ -218,7 +236,7 @@ public class PrivilegeNode extends Query
                                 objectName.getFullTableName());
                     }
                 }
-                proc = (AliasDescriptor) list.get(0);
+                proc = list.get(0);
             }
             else
             {
@@ -226,9 +244,10 @@ public class PrivilegeNode extends Query
                 boolean found = false;
                 for (int i = list.size() - 1; (!found) && i >= 0; i--)
                 {
-                    proc = (AliasDescriptor) list.get(i);
+                    proc = list.get(i);
 
-                    routineInfo = (RoutineAliasInfo) proc.getAliasInfo();
+                    RoutineAliasInfo
+                        routineInfo = (RoutineAliasInfo) proc.getAliasInfo();
                     int parameterCount = routineInfo.getParameterCount();
                     if (parameterCount != routineDesignator.paramTypeList.size())
                         continue;
@@ -246,7 +265,8 @@ public class PrivilegeNode extends Query
                 if( ! found)
                 {
                     // reconstruct the signature for the error message
-                    StringBuffer sb = new StringBuffer( objectName.getFullTableName());
+                    StringBuilder sb =
+                            new StringBuilder(objectName.getFullTableName());
                     sb.append( "(");
                     for( int i = 0; i < routineDesignator.paramTypeList.size(); i++)
                     {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java Fri Jun 21 07:47:47 2013
@@ -21,52 +21,29 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+import org.apache.derby.catalog.types.ReferencedColumnsDescriptorImpl;
+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.MethodBuilder;
 import org.apache.derby.iapi.services.context.ContextManager;
-
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.compile.AccessPath;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
+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.CostEstimate;
-import org.apache.derby.iapi.sql.compile.OptimizableList;
-import org.apache.derby.iapi.sql.compile.Visitable;
-import org.apache.derby.iapi.sql.compile.Visitor;
 import org.apache.derby.iapi.sql.compile.RequiredRowOrdering;
 import org.apache.derby.iapi.sql.compile.RowOrdering;
-import org.apache.derby.iapi.sql.compile.AccessPath;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-
+import org.apache.derby.iapi.sql.compile.Visitor;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
-import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
-
-import org.apache.derby.iapi.types.DataValueDescriptor;
-
-import org.apache.derby.iapi.sql.execute.NoPutResultSet;
-
-import org.apache.derby.iapi.sql.Activation;
-import org.apache.derby.iapi.sql.ResultSet;
-
-import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.reference.ClassName;
-
 import org.apache.derby.iapi.store.access.TransactionController;
-
-import org.apache.derby.impl.sql.compile.ExpressionClassBuilder;
-import org.apache.derby.impl.sql.compile.ActivationClassBuilder;
-
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
-
-import org.apache.derby.iapi.services.loader.GeneratedMethod;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.catalog.types.ReferencedColumnsDescriptorImpl;
 import org.apache.derby.iapi.util.JBitSet;
-import org.apache.derby.iapi.services.classfile.VMOpcode;
-
-import java.util.Properties;
-import java.util.HashSet;
-import java.util.Set;
 
 /**
  * A ProjectRestrictNode represents a result set for any of the basic DML
@@ -79,12 +56,12 @@ import java.util.Set;
  *
  */
 
-public class ProjectRestrictNode extends SingleChildResultSetNode
+class ProjectRestrictNode extends SingleChildResultSetNode
 {
 	/**
 	 * The ValueNode for the restriction to be evaluated here.
 	 */
-	public ValueNode	restriction;
+    ValueNode   restriction;
 
 	/**
 	 * Constant expressions to be evaluated here.
@@ -94,7 +71,7 @@ public class ProjectRestrictNode extends
 	/**
 	 * Restriction as a PredicateList
 	 */
-	public PredicateList restrictionList;
+    PredicateList restrictionList;
 
 	/**
 	 * List of subqueries in projection
@@ -108,19 +85,13 @@ public class ProjectRestrictNode extends
 
 	private boolean accessPathModified;
 
-	private boolean accessPathConsidered;
-
-	private boolean childResultOptimized;
-
-	private boolean materialize;
-
 	/* Should we get the table number from this node,
 	 * regardless of the class of our child.
 	 */
 	private boolean getTableNumberHere;
 
 	/**
-	 * Initializer for a ProjectRestrictNode.
+     * Constructor for a ProjectRestrictNode.
 	 *
 	 * @param childResult	The child ResultSetNode
 	 * @param projection	The result column list for the projection
@@ -130,23 +101,25 @@ public class ProjectRestrictNode extends
 	 * @param projectSubquerys List of subqueries in the projection
 	 * @param restrictSubquerys List of subqueries in the restriction
 	 * @param tableProperties	Properties list associated with the table
+     * @param cm            The context manager
 	 */
 
-	public void init(
-							Object childResult,
-			 				Object projection,
-							Object restriction,
-							Object restrictionList,
-							Object projectSubquerys,
-							Object restrictSubquerys,
-							Object tableProperties)
-	{
-		super.init(childResult, tableProperties);
-		resultColumns = (ResultColumnList) projection;
-		this.restriction = (ValueNode) restriction;
-		this.restrictionList = (PredicateList) restrictionList;
-		this.projectSubquerys = (SubqueryList) projectSubquerys;
-		this.restrictSubquerys = (SubqueryList) restrictSubquerys;
+    ProjectRestrictNode(ResultSetNode    childResult,
+                        ResultColumnList projection,
+                        ValueNode        restriction,
+                        PredicateList    restrictionList,
+                        SubqueryList     projectSubquerys,
+                        SubqueryList     restrictSubquerys,
+                        Properties       tableProperties,
+                        ContextManager   cm)
+	{
+        super(childResult, tableProperties, cm);
+        setNodeType(C_NodeTypes.PROJECT_RESTRICT_NODE);
+        resultColumns = projection;
+        this.restriction = restriction;
+        this.restrictionList = restrictionList;
+        this.projectSubquerys = projectSubquerys;
+        this.restrictSubquerys = restrictSubquerys;
 
 		/* A PRN will only hold the tableProperties for
 		 * a result set tree if its child is not an
@@ -169,6 +142,7 @@ public class ProjectRestrictNode extends
 		@see Optimizable#nextAccessPath
 		@exception StandardException	Thrown on error
 	 */
+    @Override
 	public boolean nextAccessPath(Optimizer optimizer,
 									OptimizablePredicateList predList,
 									RowOrdering rowOrdering)
@@ -198,6 +172,7 @@ public class ProjectRestrictNode extends
 	/** @see Optimizable#rememberAsBest 
 		@exception StandardException	Thrown on error
 	 */
+    @Override
 	public void rememberAsBest(int planType, Optimizer optimizer)
 		throws StandardException
 	{
@@ -206,14 +181,8 @@ public class ProjectRestrictNode extends
 			((Optimizable) childResult).rememberAsBest(planType, optimizer);
 	}
 
-	/* Don't print anything for a PRN, as their
-	 * child has the interesting info.
-	 */
-	void printRememberingBestAccessPath(int planType, AccessPath bestPath)
-	{
-	}
-
 	/** @see Optimizable#startOptimizing */
+    @Override
 	public void startOptimizing(Optimizer optimizer, RowOrdering rowOrdering)
 	{
 		if (childResult instanceof Optimizable)
@@ -222,13 +191,12 @@ public class ProjectRestrictNode extends
 		}
 		else
 		{
-			accessPathConsidered = false;
-
 			super.startOptimizing(optimizer, rowOrdering);
 		}
 	}
 
 	/** @see Optimizable#getTableNumber */
+    @Override
 	public int getTableNumber()
 	{
 		/* GROSS HACK - We need to get the tableNumber after
@@ -255,6 +223,7 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public CostEstimate optimizeIt(
 							Optimizer optimizer,
 							OptimizablePredicateList predList,
@@ -411,6 +380,7 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public boolean feasibleJoinStrategy(OptimizablePredicateList predList,
 										Optimizer optimizer)
 					throws StandardException
@@ -450,6 +420,7 @@ public class ProjectRestrictNode extends
 	}
 
 	/** @see Optimizable#getCurrentAccessPath */
+    @Override
 	public AccessPath getCurrentAccessPath()
 	{
 		if (childResult instanceof Optimizable)
@@ -459,6 +430,7 @@ public class ProjectRestrictNode extends
 	}
 
 	/** @see Optimizable#getBestAccessPath */
+    @Override
 	public AccessPath getBestAccessPath()
 	{
 		if (childResult instanceof Optimizable)
@@ -468,6 +440,7 @@ public class ProjectRestrictNode extends
 	}
 
 	/** @see Optimizable#getBestSortAvoidancePath */
+    @Override
 	public AccessPath getBestSortAvoidancePath()
 	{
 		if (childResult instanceof Optimizable)
@@ -477,6 +450,7 @@ public class ProjectRestrictNode extends
 	}
 
 	/** @see Optimizable#getTrulyTheBestAccessPath */
+    @Override
 	public AccessPath getTrulyTheBestAccessPath()
 	{
 		/* The childResult will always be an Optimizable
@@ -499,6 +473,7 @@ public class ProjectRestrictNode extends
 	}
 
 	/** @see Optimizable#rememberSortAvoidancePath */
+    @Override
 	public void rememberSortAvoidancePath()
 	{
 		if (childResult instanceof Optimizable)
@@ -508,6 +483,7 @@ public class ProjectRestrictNode extends
 	}
 
 	/** @see Optimizable#considerSortAvoidancePath */
+    @Override
 	public boolean considerSortAvoidancePath()
 	{
 		if (childResult instanceof Optimizable)
@@ -522,6 +498,7 @@ public class ProjectRestrictNode extends
 	 * @exception StandardException		Thrown on error
 	 */
 
+    @Override
 	public boolean pushOptPredicate(OptimizablePredicate optimizablePredicate)
 			throws StandardException
 	{
@@ -537,9 +514,7 @@ public class ProjectRestrictNode extends
 		/* Add the matching predicate to the restrictionList */
 		if (restrictionList == null)
 		{
-			restrictionList = (PredicateList) getNodeFactory().getNode(
-													C_NodeTypes.PREDICATE_LIST,
-													getContextManager());
+            restrictionList = new PredicateList(getContextManager());
 		}
 		restrictionList.addPredicate((Predicate) optimizablePredicate);
 
@@ -566,6 +541,7 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public void pullOptPredicates(
 								OptimizablePredicateList optimizablePredicates)
 					throws StandardException
@@ -599,6 +575,7 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public Optimizable modifyAccessPath(JBitSet outerTables) 
 		throws StandardException
 	{
@@ -826,17 +803,11 @@ public class ProjectRestrictNode extends
 		 * requalification list.
 		 */
 		PredicateList searchRestrictionList =
-								(PredicateList) getNodeFactory().getNode(
-													C_NodeTypes.PREDICATE_LIST,
-													getContextManager());
+                new PredicateList(getContextManager());
 		PredicateList joinQualifierList =
-								(PredicateList) getNodeFactory().getNode(
-													C_NodeTypes.PREDICATE_LIST,
-													getContextManager());
+                new PredicateList(getContextManager());
 		PredicateList requalificationRestrictionList =
-								(PredicateList) getNodeFactory().getNode(
-													C_NodeTypes.PREDICATE_LIST,
-													getContextManager());
+                new PredicateList(getContextManager());
 		trulyTheBestAccessPath.getJoinStrategy().divideUpPredicateLists(
 											this,
 											restrictionList,
@@ -848,9 +819,7 @@ public class ProjectRestrictNode extends
 		/* Break out the non-qualifiers from HTN's join qualifier list and make that
 		 * the new restriction list for this PRN.
 		 */
-		restrictionList = (PredicateList) getNodeFactory().getNode(
-											C_NodeTypes.PREDICATE_LIST,
-											getContextManager());
+        restrictionList = new PredicateList(getContextManager());
         /* For non-base table, we remove first 2 lists from requal list to avoid adding duplicates.
          */
 		for (int i = 0; i < searchRestrictionList.size(); i++)
@@ -887,25 +856,24 @@ public class ProjectRestrictNode extends
 		searchRestrictionList.accept(rcrv);
 
 		/* We can finally put the HTN between ourself and our old child. */
-		childResult = (ResultSetNode) getNodeFactory().getNode(
-											C_NodeTypes.HASH_TABLE_NODE,
-											childResult,
-											tableProperties, 
-											htRCList,
-											searchRestrictionList, 
-											joinQualifierList,
-											trulyTheBestAccessPath, 
-											getCostEstimate(),
-											projectSubquerys,
-											restrictSubquerys,
-											hashKeyColumns(),
-											getContextManager());
+        childResult = new HashTableNode(childResult,
+                                        tableProperties,
+                                        htRCList,
+                                        searchRestrictionList,
+                                        joinQualifierList,
+                                        trulyTheBestAccessPath,
+                                        getCostEstimate(),
+                                        projectSubquerys,
+                                        restrictSubquerys,
+                                        hashKeyColumns(),
+                                        getContextManager());
 		return this;
 	}
 
 	/** @see Optimizable#verifyProperties 
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public void verifyProperties(DataDictionary dDictionary)
 		throws StandardException
 	{
@@ -927,6 +895,7 @@ public class ProjectRestrictNode extends
 	/**
 	 * @see Optimizable#legalJoinOrder
 	 */
+    @Override
 	public boolean legalJoinOrder(JBitSet assignedTableMap)
 	{
 		if (childResult instanceof Optimizable)
@@ -944,6 +913,7 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public double uniqueJoin(OptimizablePredicateList predList)
 					throws StandardException
 	{
@@ -972,6 +942,7 @@ public class ProjectRestrictNode extends
 	 *
 	 * @return The user specified join strategy, if any for this table.
 	 */
+    @Override
 	String getUserSpecifiedJoinStrategy()
 	{
 		if (childResult instanceof FromTable)
@@ -990,8 +961,8 @@ public class ProjectRestrictNode extends
 	 *
 	 * @param depth		The depth of this node in the tree
 	 */
-
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -1047,8 +1018,8 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public ResultSetNode preprocess(int numTables,
+    @Override
+    ResultSetNode preprocess(int numTables,
 									GroupByList gbl,
 									FromList fromList) 
 								throws StandardException
@@ -1072,11 +1043,10 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void pushExpressions(PredicateList predicateList)
+    @Override
+    void pushExpressions(PredicateList predicateList)
 					throws StandardException
 	{
-		PredicateList	pushPList = null;
-
 		if (SanityManager.DEBUG)
 		SanityManager.ASSERT(predicateList != null,
 							 "predicateList is expected to be non-null");
@@ -1092,7 +1062,8 @@ public class ProjectRestrictNode extends
 		}
 
 		/* Build a list of the single table predicates that we can push down */
-		pushPList = predicateList.getPushablePredicates(referencedTableMap);
+        PredicateList pushPList =
+                predicateList.getPushablePredicates(referencedTableMap);
 
 		/* If this is a PRN above a SelectNode, probably due to a 
 		 * view or derived table which couldn't be flattened, then see
@@ -1163,14 +1134,13 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultSetNode addNewPredicate(Predicate predicate)
+    @Override
+    ResultSetNode addNewPredicate(Predicate predicate)
 			throws StandardException
 	{
 		if (restrictionList == null)
 		{
-			restrictionList = (PredicateList) getNodeFactory().getNode(
-													C_NodeTypes.PREDICATE_LIST,
-													getContextManager());
+            restrictionList = new PredicateList(getContextManager());
 		}
 		restrictionList.addPredicate(predicate);
 		return this;
@@ -1188,7 +1158,8 @@ public class ProjectRestrictNode extends
 	 *
 	 * @return boolean	Whether or not the FromSubquery is flattenable.
 	 */
-	public boolean flattenableInFromSubquery(FromList fromList)
+    @Override
+    boolean flattenableInFromSubquery(FromList fromList)
 	{
 		/* Flattening currently involves merging predicates and FromLists.
 		 * We don't have a FromList, so we can't flatten for now.
@@ -1205,7 +1176,8 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultSetNode ensurePredicateList(int numTables) 
+    @Override
+    ResultSetNode ensurePredicateList(int numTables)
 		throws StandardException
 	{
 		return this;
@@ -1223,8 +1195,8 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public ResultSetNode optimize(DataDictionary dataDictionary,
+    @Override
+    ResultSetNode optimize(DataDictionary dataDictionary,
 								  PredicateList predicates,
 								  double outerRows) 
 					throws StandardException
@@ -1236,19 +1208,18 @@ public class ProjectRestrictNode extends
 											restrictionList,
 											outerRows);
 
-		Optimizer optimizer = getOptimizer(
-								(FromList) getNodeFactory().getNode(
-									C_NodeTypes.FROM_LIST,
-									getNodeFactory().doJoinOrderOptimization(),
-									this,
-									getContextManager()),
-								predicates,
-								dataDictionary,
-								(RequiredRowOrdering) null);
+        Optimizer opt = getOptimizer(
+            new FromList(
+                getOptimizerFactory().doJoinOrderOptimization(),
+                this,
+                getContextManager()),
+            predicates,
+            dataDictionary,
+            (RequiredRowOrdering) null);
 
 		// RESOLVE: SHOULD FACTOR IN THE NON-OPTIMIZABLE PREDICATES THAT
 		// WERE NOT PUSHED DOWN
-		costEstimate = optimizer.newCostEstimate();
+        costEstimate = opt.newCostEstimate();
 
 		costEstimate.setCost(childResult.getCostEstimate().getEstimatedCost(),
 							childResult.getCostEstimate().rowCount(),
@@ -1263,7 +1234,8 @@ public class ProjectRestrictNode extends
 	 * @return	The CostEstimate for this ProjectRestrictNode, which is
 	 * 			the cost estimate for the child node.
 	 */
-	public CostEstimate getCostEstimate()
+    @Override
+    CostEstimate getCostEstimate()
 	{
 		/*
 		** The cost estimate will be set here if either optimize() or
@@ -1285,7 +1257,8 @@ public class ProjectRestrictNode extends
 	 * @return	The final CostEstimate for this ProjectRestrictNode, which is
 	 * 			the final cost estimate for the child node.
 	 */
-	public CostEstimate getFinalCostEstimate()
+    @Override
+    CostEstimate getFinalCostEstimate()
 		throws StandardException
 	{
 		if (finalCostEstimate != null)
@@ -1316,6 +1289,7 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException		Thrown on error
      */
+    @Override
     void generate(ActivationClassBuilder acb, MethodBuilder mb)
 							throws StandardException
 	{
@@ -1345,7 +1319,7 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
     void generateResultSet(ExpressionClassBuilder acb, MethodBuilder mb)
 									throws StandardException
 	{
@@ -1649,7 +1623,7 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void generateNOPProjectRestrict()
+    void generateNOPProjectRestrict()
 			throws StandardException
 	{
 		this.getResultColumns().setRedundant();
@@ -1663,7 +1637,8 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultSetNode considerMaterialization(JBitSet outerTables)
+    @Override
+    ResultSetNode considerMaterialization(JBitSet outerTables)
 		throws StandardException
 	{
 		childResult = childResult.considerMaterialization(outerTables);
@@ -1708,8 +1683,7 @@ public class ProjectRestrictNode extends
 				prRCList.genVirtualColumnNodes(this, resultColumns);
 
 				/* Finally, we create the new MaterializeResultSetNode */
-				mrsn = (MaterializeResultSetNode) getNodeFactory().getNode(
-									C_NodeTypes.MATERIALIZE_RESULT_SET_NODE,
+                mrsn = new MaterializeResultSetNode(
 									this,
 									prRCList,
 									tableProperties,
@@ -1739,9 +1713,7 @@ public class ProjectRestrictNode extends
 				 * they get applied while building the MaterializeResultSet.
 				 */
 
-				/* Finally, we create the new MaterializeResultSetNode */
-				mrsn = (MaterializeResultSetNode) getNodeFactory().getNode(
-									C_NodeTypes.MATERIALIZE_RESULT_SET_NODE,
+                mrsn = new MaterializeResultSetNode(
 									childResult,
 									prRCList,
 									tableProperties,
@@ -1771,6 +1743,7 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
     FromTable getFromTableByName(String name, String schemaName, boolean exactMatch)
 		throws StandardException
 	{
@@ -1784,7 +1757,8 @@ public class ProjectRestrictNode extends
 	 *
 	 * @return	The lock mode
 	 */
-	public int updateTargetLockMode()
+    @Override
+    int updateTargetLockMode()
 	{
 		if (restriction != null || constantRestriction != null)
 		{
@@ -1803,7 +1777,8 @@ public class ProjectRestrictNode extends
 	 * @param distinctColumns the set of distinct columns
 	 * @return Whether or not it is possible to do a distinct scan on this ResultSet tree.
 	 */
-	boolean isPossibleDistinctScan(Set distinctColumns)
+    @Override
+    boolean isPossibleDistinctScan(Set<BaseColumnNode> distinctColumns)
 	{
 		if (restriction != null || 
 			(restrictionList != null && restrictionList.size() != 0))
@@ -1825,6 +1800,7 @@ public class ProjectRestrictNode extends
 	/**
 	 * Mark the underlying scan as a distinct scan.
 	 */
+    @Override
 	void markForDistinctScan()
 	{
 		childResult.markForDistinctScan();
@@ -1838,6 +1814,7 @@ public class ProjectRestrictNode extends
 	 *
 	 * @exception StandardException on error
 	 */
+    @Override
 	void acceptChildren(Visitor v)
 		throws StandardException
 	{
@@ -1860,6 +1837,7 @@ public class ProjectRestrictNode extends
 	 * set the Information gathered from the parent table that is 
      * required to perform a referential action on dependent table.
 	 */
+    @Override
     void setRefActionInfo(long fkIndexConglomId,
 								 int[]fkColArray, 
 								 String parentResultSetId,
@@ -1871,7 +1849,7 @@ public class ProjectRestrictNode extends
 								   dependentScan);
 	}
 
-	public void setRestriction(ValueNode restriction) {
+    void setRestriction(ValueNode restriction) {
 		this.restriction = restriction;
 	}
 
@@ -1882,6 +1860,7 @@ public class ProjectRestrictNode extends
 	 *
 	 * @param orderByList	The order by list
 	 */
+    @Override
 	void pushOrderByList(OrderByList orderByList)
 	{
 		childResult.pushOrderByList(orderByList);
@@ -1895,6 +1874,7 @@ public class ProjectRestrictNode extends
      * @param fetchFirst the OFFSET FIRST, if any
      * @param hasJDBClimitClause true if the clauses were added by (and have the semantics of) a JDBC limit clause
      */
+    @Override
     void pushOffsetFetchFirst( ValueNode offset, ValueNode fetchFirst, boolean hasJDBClimitClause )
     {
         childResult.pushOffsetFetchFirst( offset, fetchFirst, hasJDBClimitClause );



Mime
View raw message