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 [13/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/QueryTreeNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java Fri Jun 21 07:47:47 2013
@@ -23,27 +23,25 @@ package	org.apache.derby.impl.sql.compil
 
 import java.sql.Types;
 import java.util.Map;
-
 import org.apache.derby.catalog.AliasInfo;
-import org.apache.derby.catalog.types.SynonymAliasInfo;
 import org.apache.derby.catalog.TypeDescriptor;
 import org.apache.derby.catalog.types.RowMultiSetImpl;
+import org.apache.derby.catalog.types.SynonymAliasInfo;
 import org.apache.derby.catalog.types.UserDefinedTypeIdImpl;
-import org.apache.derby.iapi.services.i18n.MessageService;
 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.i18n.MessageService;
 import org.apache.derby.iapi.services.loader.ClassFactory;
 import org.apache.derby.iapi.services.loader.ClassInspector;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.StatementType;
 import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
-import org.apache.derby.iapi.sql.compile.Node;
-import org.apache.derby.iapi.sql.compile.NodeFactory;
+import org.apache.derby.iapi.sql.compile.OptimizerFactory;
 import org.apache.derby.iapi.sql.compile.Parser;
 import org.apache.derby.iapi.sql.compile.TypeCompiler;
 import org.apache.derby.iapi.sql.compile.Visitable;
@@ -69,14 +67,14 @@ import org.apache.derby.impl.sql.execute
  *
  */
 
-public abstract class QueryTreeNode implements Node, Visitable
+public abstract class QueryTreeNode implements Visitable
 {
-	public static final int AUTOINCREMENT_START_INDEX = 0;
-	public static final int AUTOINCREMENT_INC_INDEX   = 1;
-	public static final int AUTOINCREMENT_IS_AUTOINCREMENT_INDEX   = 2;
+    static final int AUTOINCREMENT_START_INDEX = 0;
+    static final int AUTOINCREMENT_INC_INDEX   = 1;
+    static final int AUTOINCREMENT_IS_AUTOINCREMENT_INDEX   = 2;
 	//Parser uses this static field to make a note if the autoincrement column 
 	//is participating in create or alter table.
-	public static final int AUTOINCREMENT_CREATE_MODIFY  = 3;
+    static final int AUTOINCREMENT_CREATE_MODIFY  = 3;
 
 	private int		beginOffset = -1;		// offset into SQL input of the substring
 	                                // which this query node encodes.
@@ -111,28 +109,22 @@ public abstract class QueryTreeNode impl
 	 */
 	boolean isPrivilegeCollectionRequired = true;
 
-	/**
-	 * Set the ContextManager for this node.
-	 * 
-	 * @param cm	The ContextManager.
-	 */
-	public void setContextManager(ContextManager cm)
-	{
-		this.cm = cm;
-		
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.ASSERT(cm != null,
-				"cm not expected to be null");
-		}
-	}
+    QueryTreeNode(ContextManager cm) {
+        this.cm = cm;
 
-	/**
+        if (SanityManager.DEBUG)
+       {
+           SanityManager.ASSERT(cm != null,
+               "cm not expected to be null");
+       }
+    }
+
+    /**
 	 * Get the current ContextManager.
 	 *
 	 * @return The current ContextManager.
 	 */
-	public final ContextManager getContextManager()
+    final ContextManager getContextManager()
 	{
 		if (SanityManager.DEBUG) {
 			if (cm == null)
@@ -147,13 +139,12 @@ public abstract class QueryTreeNode impl
 	  *	@return	the node factory for this database.
 	  *
 	  */
-	public	final NodeFactory	getNodeFactory() 
+    public  final OptimizerFactory getOptimizerFactory()
 	{
 		return getLanguageConnectionContext().getLanguageConnectionFactory().
-			                                            getNodeFactory();
+                                                        getOptimizerFactory();
 	}
 
-
 	/**
 	  *	Gets the constant action factory for this database.
 	  *
@@ -277,11 +268,11 @@ public abstract class QueryTreeNode impl
 	 * @return	The node String reformatted with tab indentation
 	 */
 
-	public static String formatNodeString(String nodeString, int depth)
+    static String formatNodeString(String nodeString, int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
-			StringBuffer	nodeStringBuffer = new StringBuffer(nodeString);
+            StringBuilder   nodeStringBuilder = new StringBuilder(nodeString);
 			int		pos;
 			char		c;
 			char[]		indent = new char[depth];
@@ -296,23 +287,23 @@ public abstract class QueryTreeNode impl
 			}
 
 			/* Indent the beginning of the string */
-			nodeStringBuffer.insert(0, indent);
+            nodeStringBuilder.insert(0, indent);
 
 			/*
 			** Look for newline characters, except for the last character.
 			** We don't want to indent after the last newline.
 			*/
-			for (pos = 0; pos < nodeStringBuffer.length() - 1; pos++)
+            for (pos = 0; pos < nodeStringBuilder.length() - 1; pos++)
 			{
-				c = nodeStringBuffer.charAt(pos);
+                c = nodeStringBuilder.charAt(pos);
 				if (c == '\n')
 				{
 					/* Indent again after each newline */
-					nodeStringBuffer.insert(pos + 1, indent);
+                    nodeStringBuilder.insert(pos + 1, indent);
 				}
 			}
 
-			return nodeStringBuffer.toString();
+            return nodeStringBuilder.toString();
 		}
 		else
 		{
@@ -347,7 +338,7 @@ public abstract class QueryTreeNode impl
 	 * Print call stack for debug purposes
 	 */
 
-	public void stackPrint()
+    void stackPrint()
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -371,7 +362,7 @@ public abstract class QueryTreeNode impl
 	 *			the amount to indent it when printing it.
 	 */
 
-	public void treePrint(int depth)
+    void treePrint(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -417,7 +408,7 @@ public abstract class QueryTreeNode impl
 	 * @param outputString	The String to print
 	 */
 
-	public static void debugPrint(String outputString)
+    static void debugPrint(String outputString)
 	{
 		if (SanityManager.DEBUG) {
 			SanityManager.GET_DEBUG_STREAM().print(outputString);
@@ -459,7 +450,7 @@ public abstract class QueryTreeNode impl
 	 * @param depth		The depth to indent the sub-nodes
 	 */
 
-	public void printSubNodes(int depth)
+    void printSubNodes(int depth)
 	{
 	}
 
@@ -487,6 +478,7 @@ public abstract class QueryTreeNode impl
 	 * @return	This node formatted as a String
 	 */
 
+    @Override
 	public String toString()
 	{
 		return "";
@@ -500,7 +492,7 @@ public abstract class QueryTreeNode impl
 	 * @param label		The String to print
 	 */
 
-	public void printLabel(int depth, String label)
+    void printLabel(int depth, String label)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -540,7 +532,7 @@ public abstract class QueryTreeNode impl
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	final boolean isSessionSchema(String schemaName)
+    static boolean isSessionSchema(String schemaName)
 	{
 		return SchemaDescriptor.STD_DECLARED_GLOBAL_TEMPORARY_TABLES_SCHEMA_NAME.equals(schemaName);
 	}
@@ -573,7 +565,7 @@ public abstract class QueryTreeNode impl
 	 * 
 	 * @return true if need to collect privilege requirement for this node
 	 */
-	public boolean isPrivilegeCollectionRequired()
+    boolean isPrivilegeCollectionRequired()
 	{
 		return(isPrivilegeCollectionRequired);
 	}
@@ -618,7 +610,7 @@ public abstract class QueryTreeNode impl
 	 *
 	 * @exception StandardException		Thrown on failure
 	 */
-	public ConstantAction	makeConstantAction() throws StandardException
+    public ConstantAction makeConstantAction() throws StandardException
 	{
 		return	null;
 	}
@@ -628,7 +620,7 @@ public abstract class QueryTreeNode impl
 	 *
 	 * @param nodeType The node type.
 	 */
-	public void setNodeType(int nodeType)
+    void setNodeType(int nodeType)
 	{
 		this.nodeType = nodeType;
 	}
@@ -658,12 +650,12 @@ public abstract class QueryTreeNode impl
 	 * @return The DataDictionary
 	 *
 	 */
-	public final DataDictionary getDataDictionary()
+    final public DataDictionary getDataDictionary()
 	{
 		return getLanguageConnectionContext().getDataDictionary();
 	}
 
-	public final DependencyManager getDependencyManager()
+    final DependencyManager getDependencyManager()
 	{
 		return getDataDictionary().getDependencyManager();
 	}
@@ -812,106 +804,110 @@ public abstract class QueryTreeNode impl
     ConstantNode getNullNode(DataTypeDescriptor type)
 		throws StandardException
 	{
-        int constantNodeType;
-		switch (type.getTypeId().getJDBCTypeId())
-		{
-		  case Types.VARCHAR:
-              constantNodeType = C_NodeTypes.VARCHAR_CONSTANT_NODE;
-			break;
-
-		  case Types.CHAR:
-              constantNodeType = C_NodeTypes.CHAR_CONSTANT_NODE;
-			break;
-
-		  case Types.TINYINT:
-              constantNodeType = C_NodeTypes.TINYINT_CONSTANT_NODE;
-			break;
-
-		  case Types.SMALLINT:
-              constantNodeType = C_NodeTypes.SMALLINT_CONSTANT_NODE;
-			break;
-
-		  case Types.INTEGER:
-              constantNodeType = C_NodeTypes.INT_CONSTANT_NODE;
-			break;
-
-		  case Types.BIGINT:
-              constantNodeType = C_NodeTypes.LONGINT_CONSTANT_NODE;
-			break;
-
-		  case Types.REAL:
-              constantNodeType = C_NodeTypes.FLOAT_CONSTANT_NODE;
-			break;
-
-		  case Types.DOUBLE:
-              constantNodeType = C_NodeTypes.DOUBLE_CONSTANT_NODE;
-			break;
-
-		  case Types.NUMERIC:
-		  case Types.DECIMAL:
-              constantNodeType = C_NodeTypes.DECIMAL_CONSTANT_NODE;
-			break;
-
+        switch (type.getTypeId().getJDBCTypeId())
+        {
+          case Types.VARCHAR: {
+              CharConstantNode ccn = new CharConstantNode(
+                      C_NodeTypes.VARCHAR_CONSTANT_NODE,
+                      type.getTypeId(),
+                      cm);
+              ccn.setType(type.getNullabilityType(true));
+              return ccn;
+          }
+          case Types.CHAR: {
+              CharConstantNode ccn = new CharConstantNode(type.getTypeId(), cm);
+              ccn.setType(type.getNullabilityType(true));
+              return ccn;
+          }
+          case Types.TINYINT:
+          case Types.SMALLINT:
+          case Types.INTEGER:
+          case Types.BIGINT:
+          case Types.REAL:
+          case Types.DOUBLE:
+          case Types.DECIMAL: {
+              NumericConstantNode nvn =
+                      new NumericConstantNode(type.getTypeId(), cm);
+              nvn.setType(type.getNullabilityType(true)); // SUPERFLUOUS? FIXME
+              return nvn;
+          }
+          case Types.NUMERIC: {
+              // Map this to DECIMAL
+              NumericConstantNode ncn = new NumericConstantNode(
+                      TypeId.getBuiltInTypeId(Types.DECIMAL), cm);
+              ncn.setType(type.getNullabilityType(true)); // SUPERFLUOUS? FIXME
+              return ncn;
+          }
 		  case Types.DATE:
 		  case Types.TIME:
-		  case Types.TIMESTAMP:
-              constantNodeType = C_NodeTypes.USERTYPE_CONSTANT_NODE;
-			break;
-
-		  case Types.BINARY:
-              constantNodeType = C_NodeTypes.BIT_CONSTANT_NODE;
-			break;
-
-		  case Types.VARBINARY:
-              constantNodeType = C_NodeTypes.VARBIT_CONSTANT_NODE;
-			break;
-
-		  case Types.LONGVARCHAR:
-              constantNodeType = C_NodeTypes.LONGVARCHAR_CONSTANT_NODE;
-			break;
-
-		  case Types.CLOB:
-              constantNodeType = C_NodeTypes.CLOB_CONSTANT_NODE;
-			break;
-
-		  case Types.LONGVARBINARY:
-              constantNodeType = C_NodeTypes.LONGVARBIT_CONSTANT_NODE;
-			break;
-
-		  case Types.BLOB:
-              constantNodeType = C_NodeTypes.BLOB_CONSTANT_NODE;
-			break;
-
-          case Types.SQLXML:
-              constantNodeType = C_NodeTypes.XML_CONSTANT_NODE;
-			break;
-            
-          case Types.BOOLEAN:
-              constantNodeType = C_NodeTypes.BOOLEAN_CONSTANT_NODE;
-              break;
-
+          case Types.TIMESTAMP: {
+              UserTypeConstantNode
+                      utcn = new UserTypeConstantNode(type.getTypeId(), cm);
+              utcn.setType(type.getNullabilityType(true));
+              return utcn;
+          }
+          case Types.BINARY: {
+              BitConstantNode bcn =
+                      new BitConstantNode(type.getTypeId(), cm);
+              bcn.setType(type.getNullabilityType(true));
+              return bcn;
+          }
+          case Types.VARBINARY: {
+              VarbitConstantNode vcn =
+                      new VarbitConstantNode(type.getTypeId(), cm);
+              vcn.setType(type.getNullabilityType(true));
+              return vcn;
+          }
+          case Types.LONGVARCHAR: {
+              CharConstantNode ccn = new CharConstantNode(
+                  C_NodeTypes.LONGVARCHAR_CONSTANT_NODE, type.getTypeId(), cm);
+              ccn.setType(type.getNullabilityType(true));
+              return ccn;
+          }
+          case Types.CLOB: {
+              CharConstantNode ccn = new CharConstantNode(
+                  C_NodeTypes.CLOB_CONSTANT_NODE, type.getTypeId(), cm);
+              ccn.setType(type.getNullabilityType(true));
+              return ccn;
+          }
+          case Types.LONGVARBINARY: {
+              VarbitConstantNode vcn =
+                      new VarbitConstantNode(type.getTypeId(), cm);
+              vcn.setType(type.getNullabilityType(true));
+              return vcn;
+          }
+          case Types.BLOB: {
+              VarbitConstantNode vcn =
+                  new VarbitConstantNode(type.getTypeId(), cm);
+              vcn.setType(type.getNullabilityType(true));
+              return vcn;
+          }
+
+        case Types.SQLXML: {
+              XMLConstantNode xcn =
+                  new XMLConstantNode(type.getTypeId(), cm);
+             xcn.setType(type.getNullabilityType(true));
+              return xcn;
+          }
+          case Types.BOOLEAN: {
+              BooleanConstantNode bCn =
+                      new BooleanConstantNode(type.getTypeId(), cm);
+              bCn.setType(type.getNullabilityType(true));
+              return bCn;
+          }
 		  default:
-			if (type.getTypeId().userType())
-			{
-                constantNodeType = C_NodeTypes.USERTYPE_CONSTANT_NODE;
-			}
-			else
-			{
+           if (type.getTypeId().userType()) {
+                UserTypeConstantNode utcn =
+                        new UserTypeConstantNode(type.getTypeId(), cm);
+                utcn.setType(type.getNullabilityType(true));
+                return utcn;
+           } else {
 				if (SanityManager.DEBUG)
 				SanityManager.THROWASSERT( "Unknown type " + 
                         type.getTypeId().getSQLTypeName() + " in getNullNode");
 				return null;
 			}
 		}
-        
-        ConstantNode constantNode = (ConstantNode) getNodeFactory().getNode(
-                constantNodeType,
-                type.getTypeId(),
-                cm);
-
-        constantNode.setType(type.getNullabilityType(true));
-
-		return constantNode;
 	}
 
 	/**
@@ -921,7 +917,7 @@ public abstract class QueryTreeNode impl
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public DataValueDescriptor convertDefaultNode(DataTypeDescriptor typeDescriptor)
+    DataValueDescriptor convertDefaultNode(DataTypeDescriptor typeDescriptor)
 							throws StandardException
 	{
 		/*
@@ -931,282 +927,6 @@ public abstract class QueryTreeNode impl
 		return null;
 	}
 
-	/* Initializable methods */
-
-	/**
-	 * Initialize a query tree node.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public void init(Object arg1) throws StandardException
-	{
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.THROWASSERT("Single-argument init() not implemented for " + getClass().getName());
-		}
-	}
-
-
-	/**
-	 * Initialize a query tree node.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public void init(Object arg1,
-						Object arg2) throws StandardException
-	{
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.THROWASSERT("Two-argument init() not implemented for " + getClass().getName());
-		}
-	}
-
-	/**
-	 * Initialize a query tree node.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public void init(Object arg1,
-						Object arg2,
-						Object arg3) throws StandardException
-	{
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.THROWASSERT("Three-argument init() not implemented for " + getClass().getName());
-		}
-	}
-
-	/**
-	 * Initialize a query tree node.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public void init(Object arg1,
-						Object arg2,
-						Object arg3,
-						Object arg4) throws StandardException
-	{
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.THROWASSERT("Four-argument init() not implemented for " + getClass().getName());
-		}
-	}
-
-	/**
-	 * Initialize a query tree node.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public void init(Object arg1,
-						Object arg2,
-						Object arg3,
-						Object arg4,
-						Object arg5) throws StandardException
-	{
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.THROWASSERT("Five-argument init() not implemented for " + getClass().getName());
-		}
-	}
-
-	/**
-	 * Initialize a query tree node.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public void init(Object arg1,
-						Object arg2,
-						Object arg3,
-						Object arg4,
-						Object arg5,
-						Object arg6) throws StandardException
-	{
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.THROWASSERT("Six-argument init() not implemented for " + getClass().getName());
-		}
-	}
-
-	/**
-	 * Initialize a query tree node.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public void init(Object arg1,
-						Object arg2,
-						Object arg3,
-						Object arg4,
-						Object arg5,
-						Object arg6,
-						Object arg7) throws StandardException
-	{
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.THROWASSERT("Seven-argument init() not implemented for " + getClass().getName());
-		}
-	}
-
-	/**
-	 * Initialize a query tree node.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public void init(Object arg1,
-						Object arg2,
-						Object arg3,
-						Object arg4,
-						Object arg5,
-						Object arg6,
-						Object arg7,
-						Object arg8) throws StandardException
-	{
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.THROWASSERT("Eight-argument init() not implemented for " + getClass().getName());
-		}
-	}
-
-	/**
-	 * Initialize a query tree node.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public void init(Object arg1,
-						Object arg2,
-						Object arg3,
-						Object arg4,
-						Object arg5,
-						Object arg6,
-						Object arg7,
-						Object arg8,
-						Object arg9) throws StandardException
-	{
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.THROWASSERT("Nine-argument init() not implemented for " + getClass().getName());
-		}
-	}
-
-	/**
-	 * Initialize a query tree node.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public void init(Object arg1,
-						Object arg2,
-						Object arg3,
-						Object arg4,
-						Object arg5,
-						Object arg6,
-						Object arg7,
-						Object arg8,
-						Object arg9,
-						Object arg10) throws StandardException
-	{
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.THROWASSERT("Ten-argument init() not implemented for " + getClass().getName());
-		}
-	}
-
-	/**
-	 * Initialize a query tree node.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public void init(Object arg1,
-						Object arg2,
-						Object arg3,
-						Object arg4,
-						Object arg5,
-						Object arg6,
-						Object arg7,
-						Object arg8,
-						Object arg9,
-						Object arg10,
-						Object arg11) throws StandardException
-	{
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.THROWASSERT("Eleven-argument init() not implemented for " + getClass().getName());
-		}
-	}
-
-	/**
-	 * Initialize a query tree node.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public void init(Object arg1,
-						Object arg2,
-						Object arg3,
-						Object arg4,
-						Object arg5,
-						Object arg6,
-						Object arg7,
-						Object arg8,
-						Object arg9,
-						Object arg10,
-						Object arg11,
-						Object arg12) throws StandardException
-	{
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.THROWASSERT("Twelve-argument init() not implemented for " + getClass().getName());
-		}
-	}
-
-	/**
-	 * Initialize a query tree node.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public void init(Object arg1,
-						Object arg2,
-						Object arg3,
-						Object arg4,
-						Object arg5,
-						Object arg6,
-						Object arg7,
-						Object arg8,
-						Object arg9,
-						Object arg10,
-						Object arg11,
-						Object arg12,
-						Object arg13) throws StandardException
-	{
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.THROWASSERT("Thirteen-argument init() not implemented for " + getClass().getName());
-		}
-	}
-
-	/**
-	 * Initialize a query tree node.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public void init(Object arg1,
-						Object arg2,
-						Object arg3,
-						Object arg4,
-						Object arg5,
-						Object arg6,
-						Object arg7,
-						Object arg8,
-						Object arg9,
-						Object arg10,
-						Object arg11,
-						Object arg12,
-						Object arg13,
-						Object arg14) throws StandardException
-	{
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.THROWASSERT("Fourteen-argument init() not implemented for " + getClass().getName());
-		}
-	}
-
 	public	TableName	makeTableName
 	(
 		String	schemaName,
@@ -1215,25 +935,18 @@ public abstract class QueryTreeNode impl
 		throws StandardException
 	{
         return makeTableName
-            ( getNodeFactory(), getContextManager(), schemaName, flatName );
+            ( getContextManager(), schemaName, flatName );
 	}
 
 	public	static  TableName	makeTableName
 	(
-        NodeFactory nodeFactory,
         ContextManager contextManager,
 		String	schemaName,
 		String	flatName
 	)
 		throws StandardException
 	{
-		return (TableName) nodeFactory.getNode
-			(
-				C_NodeTypes.TABLE_NAME,
-				schemaName,
-				flatName,
-				contextManager
-			);
+        return new TableName(schemaName, flatName, contextManager);
 	}
 
 	public boolean isAtomic() throws StandardException
@@ -1431,7 +1144,7 @@ public abstract class QueryTreeNode impl
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public TableName resolveTableToSynonym(TableName tabName) throws StandardException
+    TableName resolveTableToSynonym(TableName tabName) throws StandardException
 	{
 		DataDictionary dd = getDataDictionary();
 		String nextSynonymTable = tabName.getTableName();
@@ -1464,8 +1177,11 @@ public abstract class QueryTreeNode impl
 		if (!found)
 			return null;
 
-		TableName tableName = new TableName();
-		tableName.init(nextSynonymSchema, nextSynonymTable);
+        TableName tableName = new TableName(
+                nextSynonymSchema,
+                nextSynonymTable,
+                getContextManager());
+
 		return tableName;
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNodeVector.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNodeVector.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNodeVector.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNodeVector.java Fri Jun 21 07:47:47 2013
@@ -25,6 +25,7 @@ import java.util.ArrayList;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.compile.Visitor;
 import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.services.context.ContextManager;
 
 /**
  * QueryTreeNodeVector is the root class for all lists of query tree nodes.
@@ -37,6 +38,10 @@ abstract class QueryTreeNodeVector exten
 {
 	private final ArrayList<QueryTreeNode> v = new ArrayList<QueryTreeNode>();
 
+    QueryTreeNodeVector(ContextManager cm) {
+        super(cm);
+    }
+
 	public final int size()
 	{
 		return v.size();
@@ -44,7 +49,7 @@ abstract class QueryTreeNodeVector exten
 
 	final QueryTreeNode elementAt(int index)
 	{
-		return (QueryTreeNode) v.get(index);
+        return v.get(index);
 	}
 
 	final void addElement(QueryTreeNode qt)
@@ -64,7 +69,7 @@ abstract class QueryTreeNodeVector exten
 
 	final Object remove(int index)
 	{
-		return((QueryTreeNode) (v.remove(index)));
+        return v.remove(index);
 	}
 
 	final int indexOf(QueryTreeNode qt)
@@ -104,11 +109,12 @@ abstract class QueryTreeNodeVector exten
 	 * how tree printing is supposed to work.
 	 * @param depth		The depth to indent the sub-nodes
 	 */
-	public void printSubNodes(int depth) {
+    @Override
+    void printSubNodes(int depth) {
 		if (SanityManager.DEBUG) {
 			for (int index = 0; index < size(); index++) {
 				debugPrint(formatNodeString("[" + index + "]:", depth));
-				QueryTreeNode elt = (QueryTreeNode)elementAt(index);
+                QueryTreeNode elt = elementAt(index);
 				elt.treePrint(depth);
 			}
 		}
@@ -122,6 +128,7 @@ abstract class QueryTreeNodeVector exten
 	 *
 	 * @exception StandardException on error
 	 */
+    @Override
 	void acceptChildren(Visitor v)
 		throws StandardException
 	{
@@ -130,7 +137,7 @@ abstract class QueryTreeNodeVector exten
 		int size = size();
 		for (int index = 0; index < size; index++)
 		{
-			setElementAt((QueryTreeNode)((QueryTreeNode) elementAt(index)).accept(v), index);
+            setElementAt((QueryTreeNode)(elementAt(index)).accept(v), index);
 		}
 	}
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RefTypeCompiler.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RefTypeCompiler.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RefTypeCompiler.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RefTypeCompiler.java Fri Jun 21 07:47:47 2013
@@ -21,29 +21,19 @@
 
 package org.apache.derby.impl.sql.compile;
 
+import org.apache.derby.iapi.reference.ClassName;
 import org.apache.derby.iapi.services.loader.ClassFactory;
-
-import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.types.TypeId;
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-import org.apache.derby.iapi.types.DataValueFactory;
-
-import org.apache.derby.iapi.types.RefDataValue;
-
-import org.apache.derby.iapi.sql.compile.TypeCompiler;
-
 import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.iapi.reference.ClassName;
+import org.apache.derby.iapi.sql.compile.TypeCompiler;
+import org.apache.derby.iapi.types.DataTypeDescriptor;
+import org.apache.derby.iapi.types.TypeId;
 
 /**
  * This class implements TypeCompiler for the SQL REF datatype.
  *
  */
 
-public class RefTypeCompiler extends BaseTypeCompiler
+class RefTypeCompiler extends BaseTypeCompiler
 {
 	/** @see TypeCompiler#getCorrespondingPrimitiveTypeName */
 	public String getCorrespondingPrimitiveTypeName()

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ReferencedTablesVisitor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ReferencedTablesVisitor.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ReferencedTablesVisitor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ReferencedTablesVisitor.java Fri Jun 21 07:47:47 2013
@@ -22,22 +22,20 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.sql.compile.Visitable; 
 import org.apache.derby.iapi.sql.compile.Visitor;
-
-import org.apache.derby.iapi.error.StandardException;
-
 import org.apache.derby.iapi.util.JBitSet;
 
 /**
  * Build a JBitSet of all of the referenced tables in the tree.
  *
  */
-public class ReferencedTablesVisitor implements Visitor 
+class ReferencedTablesVisitor implements Visitor
 {
 	private JBitSet tableMap;
 
-	public ReferencedTablesVisitor(JBitSet tableMap)
+    ReferencedTablesVisitor(JBitSet tableMap)
 	{
 		this.tableMap = tableMap;
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RelationalOperator.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RelationalOperator.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RelationalOperator.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RelationalOperator.java Fri Jun 21 07:47:47 2013
@@ -21,15 +21,11 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
-
 import org.apache.derby.iapi.error.StandardException;
-
+import org.apache.derby.iapi.services.compiler.MethodBuilder;
 import org.apache.derby.iapi.sql.compile.ExpressionClassBuilderInterface;
 import org.apache.derby.iapi.sql.compile.Optimizable;
-
 import org.apache.derby.iapi.store.access.TransactionController;
-
 import org.apache.derby.iapi.types.DataValueDescriptor;
 
 /**
@@ -39,14 +35,14 @@ import org.apache.derby.iapi.types.DataV
  */
 interface RelationalOperator
 {
-	public final int EQUALS_RELOP = 1;
-	public final int NOT_EQUALS_RELOP = 2;
-	public final int GREATER_THAN_RELOP = 3;
-	public final int GREATER_EQUALS_RELOP = 4;
-	public final int LESS_THAN_RELOP = 5;
-	public final int LESS_EQUALS_RELOP = 6;
-	public final int IS_NULL_RELOP = 7;
-	public final int IS_NOT_NULL_RELOP = 8;
+    final int EQUALS_RELOP = 1;
+    final int NOT_EQUALS_RELOP = 2;
+    final int GREATER_THAN_RELOP = 3;
+    final int GREATER_EQUALS_RELOP = 4;
+    final int LESS_THAN_RELOP = 5;
+    final int LESS_EQUALS_RELOP = 6;
+    final int IS_NULL_RELOP = 7;
+    final int IS_NOT_NULL_RELOP = 8;
 
 	/**
 	 * Check whether this RelationalOperator is a comparison of the given
@@ -322,7 +318,7 @@ interface RelationalOperator
 	 *
 	 * @return int		The operator for this RelationalOperator.
 	 */
-	public int getOperator();
+    int getOperator();
 
 	/**
 	 * Return the variant type for the Qualifier's Orderable.
@@ -333,14 +329,15 @@ interface RelationalOperator
 	 * @return int		The variant type for the Qualifier's Orderable.
 	 * @exception StandardException	thrown on error
 	 */
-	public int getOrderableVariantType(Optimizable optTable)
+    int getOrderableVariantType(Optimizable optTable)
 		throws StandardException;
 
 	/**
 	 * Return whether this operator compares the given Optimizable with
 	 * a constant whose value is known at compile time.
 	 */
-	public boolean compareWithKnownConstant(Optimizable optTable, boolean considerParameters);
+    boolean compareWithKnownConstant(
+        Optimizable optTable, boolean considerParameters);
 
 	/**
 	 * Return an Object representing the known value that this relational
@@ -348,14 +345,14 @@ interface RelationalOperator
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public DataValueDescriptor getCompareValue(Optimizable optTable)
+    DataValueDescriptor getCompareValue(Optimizable optTable)
 					throws StandardException;
 
 	/**
 	 * Return whether this operator is an equality comparison of the given
 	 * optimizable with a constant expression.
 	 */
-	public boolean equalsComparisonWithConstantExpression(Optimizable optTable);
+    boolean equalsComparisonWithConstantExpression(Optimizable optTable);
 
 	/**
 	 * Return a relational operator which matches the current one
@@ -368,6 +365,6 @@ interface RelationalOperator
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public RelationalOperator getTransitiveSearchClause(ColumnReference otherCR)
+    RelationalOperator getTransitiveSearchClause(ColumnReference otherCR)
 		throws StandardException;
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RemapCRsVisitor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RemapCRsVisitor.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RemapCRsVisitor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RemapCRsVisitor.java Fri Jun 21 07:47:47 2013
@@ -22,21 +22,20 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.sql.compile.Visitable; 
 import org.apache.derby.iapi.sql.compile.Visitor;
 
-import org.apache.derby.iapi.error.StandardException;
-
 /**
  * Remap/unremap the CRs to the underlying
  * expression.
  *
  */
-public class RemapCRsVisitor implements Visitor
+class RemapCRsVisitor implements Visitor
 {
 	private boolean remap;
 
-	public RemapCRsVisitor(boolean remap)
+    RemapCRsVisitor(boolean remap)
 	{
 		this.remap = remap;
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RenameNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RenameNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RenameNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RenameNode.java Fri Jun 21 07:47:47 2013
@@ -21,34 +21,31 @@
 
 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.services.context.ContextManager;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.StatementType;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
-import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
-import org.apache.derby.iapi.sql.dictionary.DataDictionary;
-import org.apache.derby.iapi.sql.dictionary.TupleDescriptor;
-import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
-import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList;
+import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList;
-import org.apache.derby.iapi.sql.dictionary.CheckConstraintDescriptor;
+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.dictionary.TupleDescriptor;
 import org.apache.derby.iapi.sql.execute.ConstantAction;
 
-import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.iapi.sql.StatementType;
-
 /**
  * A RenameNode is the root of a QueryTree that represents a
  * RENAME TABLE/COLUMN/INDEX statement.
  *
  */
 
-public class RenameNode extends DDLStatementNode
+class RenameNode extends DDLStatementNode
 {
 	protected TableName newTableName;
 
@@ -73,14 +70,17 @@ public class RenameNode extends DDLState
 	protected int renamingWhat;
 
 	/**
-	 * Initializer for a RenameNode
+     * Constructor for a RenameNode
 	 *
 	 * @param tableName The name of the table. This is the table which is
 	 *		being renamed in case of rename table. In case of rename
 	 *		column, the column being renamed belongs to this table.
 	 *		In case of rename index, this is null because index name
 	 *		is unique within a schema and doesn't have to be
-	 *		associated with a table name
+     *      associated with a table name.
+     *      Coming from ALTER TABLE path, tableName will
+     *      be TableName object. Mostly a TableName object, but coming from
+     *      RENAME COLUMN path, tableName will be a String.
 	 * @param oldObjectName This is either the name of column/index in case
 	 *		of rename column/index. For rename table, this is null.
 	 * @param newObjectName This is new name for table/column/index
@@ -88,25 +88,28 @@ public class RenameNode extends DDLState
 	 *		For rename index, this will always be false because
 	 *		there is no alter table command to rename index
 	 * @param renamingWhat Rename a 1 - table, 2 - column, 3 - index
+     * @param cm context manager
 	 *
 	 * @exception StandardException Thrown on error
 	 */
-	public void init(Object tableName,
-				   Object oldObjectName,
-				   Object newObjectName,
-				   Object usedAlterTable,
-				   Object renamingWhat)
-		throws StandardException
+    RenameNode(Object tableName,
+               String oldObjectName,
+               String newObjectName,
+               boolean usedAlterTable,
+               int renamingWhat,
+               ContextManager cm) throws StandardException
 	{
-		this.usedAlterTable = ((Boolean) usedAlterTable).booleanValue();
-		this.renamingWhat = ((Integer) renamingWhat).intValue();
+        super(cm);
+        setNodeType(C_NodeTypes.RENAME_NODE);
+        this.usedAlterTable = usedAlterTable;
+        this.renamingWhat = renamingWhat;
 
 		switch (this.renamingWhat)
 		{
 			case StatementType.RENAME_TABLE:
 				initAndCheck((TableName) tableName);
 				this.newTableName =
-					makeTableName(getObjectName().getSchemaName(),(String)newObjectName);
+                    makeTableName(getObjectName().getSchemaName(), newObjectName);
 				this.oldObjectName = null;
 				this.newObjectName = this.newTableName.getTableName();
 				break;
@@ -125,13 +128,13 @@ public class RenameNode extends DDLState
 				initAndCheck(actingObjectName);
 
 
-				this.oldObjectName = (String)oldObjectName;
-				this.newObjectName = (String)newObjectName;
+                this.oldObjectName = oldObjectName;
+                this.newObjectName = newObjectName;
 				break;
 
 			case StatementType.RENAME_INDEX:
-				this.oldObjectName = (String)oldObjectName;
-				this.newObjectName = (String)newObjectName;
+                this.oldObjectName = oldObjectName;
+                this.newObjectName = newObjectName;
 				break;
 
 			default:
@@ -147,7 +150,7 @@ public class RenameNode extends DDLState
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG) {
@@ -180,7 +183,7 @@ public class RenameNode extends DDLState
 		}
 	}
 
-	public String statementToString()
+    String statementToString()
 	{
 		if (usedAlterTable)
 			return "ALTER TABLE";
@@ -225,7 +228,7 @@ public class RenameNode extends DDLState
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
 	public void bindStatement() throws StandardException
 	{
 		CompilerContext			cc = getCompilerContext();
@@ -274,9 +277,9 @@ public class RenameNode extends DDLState
 		{
 			case StatementType.RENAME_TABLE:
 				/* Verify that new table name does not exist in the database */
-				TableDescriptor td = getTableDescriptor(newObjectName, sd);
-  				if (td != null)
-					throw descriptorExistsException(td, sd);
+                TableDescriptor tabDesc = getTableDescriptor(newObjectName, sd);
+                if (tabDesc != null)
+                    throw descriptorExistsException(tabDesc, sd);
 				renameTableBind(dd);
 				break;
 
@@ -314,6 +317,7 @@ public class RenameNode extends DDLState
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public boolean referencesSessionSchema()
 		throws StandardException
 	{
@@ -429,7 +433,8 @@ public class RenameNode extends DDLState
 	 *
 	 * @exception StandardException		Thrown on failure
 	 */
-	public ConstantAction	makeConstantAction()
+    @Override
+    public ConstantAction   makeConstantAction()
 		throws StandardException
 	{
 		return	getGenericConstantActionFactory().getRenameConstantAction(getFullName(),

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ReplaceAggregatesWithCRVisitor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ReplaceAggregatesWithCRVisitor.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ReplaceAggregatesWithCRVisitor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ReplaceAggregatesWithCRVisitor.java Fri Jun 21 07:47:47 2013
@@ -22,16 +22,15 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.sql.compile.Visitable; 
 import org.apache.derby.iapi.sql.compile.Visitor;
 
-import org.apache.derby.iapi.error.StandardException;
-
 /**
  * Replace all aggregates with result columns.
  *
  */
-public class ReplaceAggregatesWithCRVisitor implements Visitor
+class ReplaceAggregatesWithCRVisitor implements Visitor
 {
 	private ResultColumnList rcl;
 	private Class skipOverClass;
@@ -45,12 +44,13 @@ public class ReplaceAggregatesWithCRVisi
 	 * @param rcl the result column list
 	 * @param tableNumber	The tableNumber for the new CRs
 	 */
-	public ReplaceAggregatesWithCRVisitor(ResultColumnList rcl, int tableNumber)
+    ReplaceAggregatesWithCRVisitor(ResultColumnList rcl, int tableNumber)
 	{
 		this(rcl, tableNumber, null);
 	}
 
-	public ReplaceAggregatesWithCRVisitor(ResultColumnList rcl, int tableNumber, Class skipOverClass)
+    ReplaceAggregatesWithCRVisitor(
+        ResultColumnList rcl, int tableNumber, Class skipOverClass)
 	{
 		this.rcl = rcl;
 		this.tableNumber = tableNumber;
@@ -66,7 +66,7 @@ public class ReplaceAggregatesWithCRVisi
 	 * @param rcl the result column list
 	 * @param nodeToSkip don't examine anything below nodeToSkip
 	 */
-	public ReplaceAggregatesWithCRVisitor(ResultColumnList rcl, Class nodeToSkip)
+    ReplaceAggregatesWithCRVisitor(ResultColumnList rcl, Class nodeToSkip)
 	{
 		this.rcl = rcl;
 		this.skipOverClass = nodeToSkip;
@@ -104,7 +104,7 @@ public class ReplaceAggregatesWithCRVisi
 	}
 
 	/**
-	 * Don't visit childen under the skipOverClass
+     * Don't visit children under the skipOverClass
 	 * node, if it isn't null.
 	 *
 	 * @return true/false

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ReplaceWindowFuncCallsWithCRVisitor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ReplaceWindowFuncCallsWithCRVisitor.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ReplaceWindowFuncCallsWithCRVisitor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ReplaceWindowFuncCallsWithCRVisitor.java Fri Jun 21 07:47:47 2013
@@ -21,16 +21,15 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.sql.compile.Visitable;
 import org.apache.derby.iapi.sql.compile.Visitor;
 
-import org.apache.derby.iapi.error.StandardException;
-
 /**
  * Replace all window function calls with result columns.
  *
  */
-public class ReplaceWindowFuncCallsWithCRVisitor implements Visitor
+class ReplaceWindowFuncCallsWithCRVisitor implements Visitor
 {
 	private ResultColumnList rcl;
 	private Class skipOverClass;
@@ -45,7 +44,7 @@ public class ReplaceWindowFuncCallsWithC
 	 * @param tableNumber	The tableNumber for the new CRs
 	 * @param skipOverClass Don't go past this
 	 */
-	public ReplaceWindowFuncCallsWithCRVisitor(ResultColumnList rcl,
+    ReplaceWindowFuncCallsWithCRVisitor(ResultColumnList rcl,
 											int tableNumber,
 											Class skipOverClass)
 	{
@@ -62,7 +61,7 @@ public class ReplaceWindowFuncCallsWithC
 
 	/**
 	 * Don't do anything unless we have a window function node
-	 * node. Vistor override.
+     * node. Visitor override.
 	 * @see Visitor#visit
 	 *
 	 */
@@ -82,8 +81,8 @@ public class ReplaceWindowFuncCallsWithC
 	}
 
 	/**
-	 * Don't visit childen under the skipOverClass
-	 * node, if it isn't null. Vistor override.
+     * Don't visit children under the skipOverClass
+     * node, if it isn't null. Visitor override.
 	 * @see Visitor#skipChildren
 	 */
 	public boolean skipChildren(Visitable node)
@@ -95,7 +94,7 @@ public class ReplaceWindowFuncCallsWithC
 
 
 	/**
-	 * Vistor override.
+     * Visitor override.
 	 * @return false
 	 * @see Visitor#visitChildrenFirst
 	 */
@@ -105,7 +104,7 @@ public class ReplaceWindowFuncCallsWithC
 	}
 
 	/**
-	 * Vistor override.
+     * Visitor override.
 	 * @return false
 	 * @see Visitor#skipChildren
 	 */

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java Fri Jun 21 07:47:47 2013
@@ -22,11 +22,10 @@
 package	org.apache.derby.impl.sql.compile;
 
 import java.util.List;
-
 import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.reference.ClassName;
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.ResultColumnDescriptor;
@@ -63,8 +62,8 @@ import org.apache.derby.iapi.util.String
  *
  */
 
-public class ResultColumn extends ValueNode 
-				implements ResultColumnDescriptor, Comparable
+class ResultColumn extends ValueNode
+                implements ResultColumnDescriptor, Comparable<ResultColumn>
 {
 	/* name and exposedName should point to the same string, unless there is a
 	 * derived column list, in which case name will point to the underlying name
@@ -124,101 +123,101 @@ public class ResultColumn extends ValueN
 	/* virtualColumnId is the ResultColumn's position (1-based) within the ResultSet */
 	private int		virtualColumnId;
 
-	/**
-	 * Different types of initializer parameters indicate different
-	 * types of initialization. Parameters may be:
-	 *
-	 * <ul>
-	 * <li>arg1	The name of the column, if any.</li>
-	 * <li>arg2	The expression this result column represents</li>
-	 * </ul>
-	 *
-	 * <p>
-	 * - OR -
-	 * </p>
-	 *
-	 * <ul>
-	 * <li>arg1	a column reference node</li>
-	 * <li>arg2	The expression this result column represents</li>
-	 * </ul>
-	 *
-	 * <p>
-	 * - OR -
-	 * </p>
-	 *
-	 * <ul>
-	 * <li>arg1	The column descriptor.</li>
-	 * <li>arg2	The expression this result column represents</li>
-	 * </ul>
-	 *
-	 * <p>
-	 * - OR -
-	 * </p>
-	 *
-	 * <ul>
-	 * <li>dtd			The type of the column</li>
-	 * <li>expression	The expression this result column represents</li>
-	 * </ul>
-	 */
-	public void init(Object arg1, Object arg2) throws StandardException
-	{
-		// RESOLVE: This is something of a hack - it is not obvious that
-		// the first argument being null means it should be treated as
-		// a String.
-		if ((arg1 instanceof String) || (arg1 == null))
-		{
-			this.name = (String) arg1;
-			this.exposedName = this.name;
-			setExpression( (ValueNode) arg2 );
-		}
-		else if (arg1 instanceof ColumnReference)
-		{
-			ColumnReference ref = (ColumnReference) arg1;
-
-			this.name = ref.getColumnName();
-			this.exposedName = ref.getColumnName();
-			/*
-				when we bind, we'll want to make sure
-				the reference has the right table name.
-		 	*/
-			this.reference = ref; 
-			setExpression( (ValueNode) arg2 );
-		}
-		else if (arg1 instanceof ColumnDescriptor)
-		{
-			ColumnDescriptor coldes = (ColumnDescriptor) arg1;
-
-			this.name = coldes.getColumnName();
-			this.exposedName = name;
-			setType(coldes.getType());
-			this.columnDescriptor = coldes;
-			setExpression( (ValueNode) arg2 );
-			this.autoincrement = coldes.isAutoincrement();
-		}
-		else
-		{
-			setType((DataTypeDescriptor) arg1);
-			setExpression( (ValueNode) arg2 );
-			if (arg2 instanceof ColumnReference)
-			{
-				reference = (ColumnReference) arg2;
-			}
-		}
-		
-		/* this result column represents a <default> keyword in an insert or
-		 * update statement
-		 */
-		if (expression != null &&
-			expression.isInstanceOf(C_NodeTypes.DEFAULT_NODE))
-			defaultColumn = true;
-	}
-	
-	/**
+    ResultColumn(ContextManager cm) {
+        super(cm);
+    }
+
+    /**
+     * @param name The name of the column, if any.
+     * @param expression The expression this result column represents
+     * @param cm context manager
+     */
+    ResultColumn(
+            String name,
+            ValueNode expression,
+            ContextManager cm) throws StandardException {
+        super(cm);
+        setTypeExpressionAndDefault(expression);
+        this.name = name;
+        this.exposedName = this.name;
+    }
+
+    /**
+     * @param cr A column reference node
+     * @param expression The expression this result column represents
+     * @param cm context manager
+     * @throws StandardException
+     */
+    ResultColumn(
+            ColumnReference cr,
+            ValueNode expression,
+            ContextManager cm) throws StandardException {
+        super(cm);
+        setTypeExpressionAndDefault(expression);
+        this.name = cr.getColumnName();
+        this.exposedName = cr.getColumnName();
+
+        // When we bind, we'll want to make sure the reference has the right
+        // table name.
+        this.reference = cr;
+    }
+
+    /**
+     * @param cd The column descriptor
+     * @param expression The expression this result column represents
+     * @param cm context manager
+     * @throws StandardException
+     */
+    ResultColumn(
+            ColumnDescriptor cd,
+            ValueNode expression,
+            ContextManager cm) throws StandardException {
+        super(cm);
+        setTypeExpressionAndDefault(expression);
+        this.name = cd.getColumnName();
+        this.exposedName = name;
+        setType(cd.getType());
+        this.columnDescriptor = cd;
+        this.autoincrement = cd.isAutoincrement();
+    }
+
+    /**
+     * @param dtd The type of the column
+     * @param expression The expression this result column represents
+     * @param cm context manager
+     * @throws StandardException
+     */
+    ResultColumn(
+            DataTypeDescriptor dtd,
+            ValueNode expression,
+            ContextManager cm) throws StandardException {
+        super(cm);
+        setTypeExpressionAndDefault(expression);
+        setType(dtd);
+
+        if (expression instanceof ColumnReference) {
+            reference = (ColumnReference)expression;
+        }
+    }
+
+    private void setTypeExpressionAndDefault(ValueNode expression) {
+        setNodeType(C_NodeTypes.RESULT_COLUMN);
+        setExpression(expression);
+
+        if (expression != null &&
+           expression.isInstanceOf(C_NodeTypes.DEFAULT_NODE)) {
+            // This result column represents a <default> keyword in an insert or
+            // update statement
+            defaultColumn = true;
+        }
+    }
+
+    /**
 	 * Returns TRUE if the ResultColumn is join column for a RIGHT OUTER 
 	 *  JOIN with USING/NATURAL. More comments at the top of this class
 	 *  where rightOuterJoinUsingClause is defined.
 	 */
-	public boolean isRightOuterJoinUsingClause()
+    boolean isRightOuterJoinUsingClause()
 	{
 		return rightOuterJoinUsingClause;
 	}
@@ -244,7 +243,7 @@ public class ResultColumn extends ValueN
 	 *  
 	 * @param value True/False
 	 */
-	public void setRightOuterJoinUsingClause(boolean value)
+    void setRightOuterJoinUsingClause(boolean value)
 	{
 		rightOuterJoinUsingClause = value;
 	}
@@ -261,7 +260,7 @@ public class ResultColumn extends ValueN
 	 * rightOuterJoinUsingClause will be used during the code generation 
 	 * time.
 	 */
-	public JoinNode getJoinResultSet() {
+    JoinNode getJoinResultSet() {
 		return joinResultSet;
 	}
 
@@ -274,7 +273,7 @@ public class ResultColumn extends ValueN
 	 *   This case is talking about column c as in "select c"
 	 * @param resultSet - The ResultColumn belongs to this JoinNode
 	 */
-	public void setJoinResultset(JoinNode resultSet)
+    void setJoinResultset(JoinNode resultSet)
 	{
 		joinResultSet = resultSet;
 	}
@@ -283,12 +282,12 @@ public class ResultColumn extends ValueN
 	 * Returns TRUE if the ResultColumn is standing in for a DEFAULT keyword in
 	 * an insert/update statement.
 	 */
-	public boolean isDefaultColumn()
+    boolean isDefaultColumn()
 	{
 		return defaultColumn;
 	}
 
-	public void setDefaultColumn(boolean value)
+    void setDefaultColumn(boolean value)
 	{
 		defaultColumn = value;
 	}
@@ -297,12 +296,12 @@ public class ResultColumn extends ValueN
 	 * Returns TRUE if the ResultColumn used to stand in for a DEFAULT keyword in
 	 * an insert/update statement.
 	 */
-	public boolean wasDefaultColumn()
+    boolean wasDefaultColumn()
 	{
 		return wasDefault;
 	}
 
-	public void setWasDefaultColumn(boolean value)
+    void setWasDefaultColumn(boolean value)
 	{
 		wasDefault = value;
 	}
@@ -376,7 +375,8 @@ public class ResultColumn extends ValueN
 		return exposedName;
 	}
 
-	public String getSchemaName() throws StandardException
+    @Override
+    String getSchemaName() throws StandardException
 	{
 		if ((columnDescriptor!=null) &&
 			(columnDescriptor.getTableDescriptor() != null))
@@ -391,7 +391,8 @@ public class ResultColumn extends ValueN
 		}
 	}
 
-	public String getTableName()
+    @Override
+    String getTableName()
 	{
 		if (tableName != null)
 		{
@@ -428,7 +429,7 @@ public class ResultColumn extends ValueN
 	 * Clear the table name for the underlying ColumnReference.
 	 * See UpdateNode.scrubResultColumns() for full explaination.
 	 */
-	public void clearTableName()
+    void clearTableName()
 	{
 		if (expression instanceof ColumnReference)
 		{
@@ -460,7 +461,7 @@ public class ResultColumn extends ValueN
 	 * @param expression	The expression to be set in this ResultColumn
 	 */
 
-	public void setExpression(ValueNode expression)
+    void setExpression(ValueNode expression)
 	{
 		this.expression = expression;
 	}
@@ -471,7 +472,7 @@ public class ResultColumn extends ValueN
 	 * @return ValueNode	this.expression
 	 */
 
-	public ValueNode getExpression()
+    ValueNode getExpression()
 	{
 		return expression;
 	}
@@ -498,7 +499,7 @@ public class ResultColumn extends ValueN
 	 * @param name	The name to set in this ResultColumn
 	 */
 
-	public void setName(String name)
+    void setName(String name)
 	{
 		if (this.name == null)
 		{
@@ -517,7 +518,7 @@ public class ResultColumn extends ValueN
 	/**
 	 * Is the name for this ResultColumn generated?
 	 */
-	public boolean isNameGenerated()
+    boolean isNameGenerated()
 	{
 		return isNameGenerated;
 	}
@@ -525,7 +526,7 @@ public class ResultColumn extends ValueN
 	/**
 	 * Set that this result column name is generated.
 	 */
-	public void setNameGenerated(boolean value)
+    void setNameGenerated(boolean value)
 	{
 		isNameGenerated = value;
 	}
@@ -538,7 +539,7 @@ public class ResultColumn extends ValueN
 	 *
 	 * @param resultSetNumber	The resultSetNumber.
 	 */
-	public void setResultSetNumber(int resultSetNumber)
+    void setResultSetNumber(int resultSetNumber)
 	{
 		this.resultSetNumber = resultSetNumber;
 	}
@@ -559,7 +560,7 @@ public class ResultColumn extends ValueN
 	 * @param adjust	The adjustment for the virtualColumnId
 	 */
 
-	public void adjustVirtualColumnId(int adjust)
+    void adjustVirtualColumnId(int adjust)
 	{
 		virtualColumnId += adjust;
 	}
@@ -570,7 +571,7 @@ public class ResultColumn extends ValueN
 	 * @param id	The virtualColumnId for this ResultColumn
 	 */
 
-	public void setVirtualColumnId(int id)
+    void setVirtualColumnId(int id)
 	{
 		virtualColumnId = id;
 	}
@@ -580,7 +581,7 @@ public class ResultColumn extends ValueN
 	 *
 	 * @return virtualColumnId for this ResultColumn
 	 */
-	public int getVirtualColumnId()
+    int getVirtualColumnId()
 	{
 		return virtualColumnId;
 	}
@@ -599,7 +600,7 @@ public class ResultColumn extends ValueN
 	 *
 	 * @param removedColumnId   id of the column being removed.
 	 */
-	public void collapseVirtualColumnIdGap(int removedColumnId)
+    void collapseVirtualColumnIdGap(int removedColumnId)
 	{
 		if (columnDescriptor == null && virtualColumnId > removedColumnId)
 			virtualColumnId--;
@@ -611,7 +612,7 @@ public class ResultColumn extends ValueN
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void guaranteeColumnName() throws StandardException
+    void guaranteeColumnName() throws StandardException
 	{
 		if (exposedName == null)
 		{
@@ -627,7 +628,7 @@ public class ResultColumn extends ValueN
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
@@ -664,8 +665,8 @@ public class ResultColumn extends ValueN
 	 *
 	 * @param depth		The depth of this node in the tree
 	 */
-
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -701,7 +702,7 @@ public class ResultColumn extends ValueN
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
     ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)
 				throws StandardException
 	{
@@ -768,11 +769,11 @@ public class ResultColumn extends ValueN
 					int columnId)
 				throws StandardException
 	{
-		ColumnDescriptor	columnDescriptor;
+        ColumnDescriptor    colDesc;
 
-		columnDescriptor = tableDescriptor.getColumnDescriptor(columnId);
+        colDesc = tableDescriptor.getColumnDescriptor(columnId);
 
-		if (columnDescriptor == null)
+        if (colDesc == null)
 		{
 			String		errorString;
 			String		schemaName;
@@ -786,7 +787,7 @@ public class ResultColumn extends ValueN
 			throw StandardException.newException(SQLState.LANG_TOO_MANY_RESULT_COLUMNS, errorString);
 		}
 
-		setColumnDescriptor(tableDescriptor, columnDescriptor);
+        setColumnDescriptor(tableDescriptor, colDesc);
 		setVirtualColumnId(columnId);
 	}
 
@@ -810,15 +811,15 @@ public class ResultColumn extends ValueN
 	 * @exception StandardException		Thrown on error
 	 */
 
-	public void bindResultColumnByName(TableDescriptor tableDescriptor,
+    void bindResultColumnByName(TableDescriptor tableDescriptor,
 					int columnId)
 				throws StandardException
 	{
-		ColumnDescriptor	columnDescriptor;
+        ColumnDescriptor    colDesc;
 
-		columnDescriptor = tableDescriptor.getColumnDescriptor(exposedName);
+        colDesc = tableDescriptor.getColumnDescriptor(exposedName);
 
-		if (columnDescriptor == null)
+        if (colDesc == null)
 		{
 			String		errorString;
 			String		schemaName;
@@ -832,10 +833,10 @@ public class ResultColumn extends ValueN
 			throw StandardException.newException(SQLState.LANG_COLUMN_NOT_FOUND_IN_TABLE, exposedName, errorString);
 		}
 
-		setColumnDescriptor(tableDescriptor, columnDescriptor);
+        setColumnDescriptor(tableDescriptor, colDesc);
 		setVirtualColumnId(columnId);
 		if (isPrivilegeCollectionRequired())
-			getCompilerContext().addRequiredColumnPriv( columnDescriptor);
+            getCompilerContext().addRequiredColumnPriv( colDesc);
 	}
 
 	/**
@@ -843,7 +844,7 @@ public class ResultColumn extends ValueN
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void typeUntypedNullExpression( ResultColumn bindingRC)
+    void typeUntypedNullExpression( ResultColumn bindingRC)
 			throws StandardException
 	{
         TypeId typeId = bindingRC.getTypeId();
@@ -927,7 +928,7 @@ public class ResultColumn extends ValueN
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void bindResultColumnToExpression()
+    void bindResultColumnToExpression()
 				throws StandardException
 	{
 		/*
@@ -951,7 +952,7 @@ public class ResultColumn extends ValueN
 	 * Set the column source's table name
 	 * @param t The source table name
 	 */
-	public void setSourceTableName(String t) {
+    void setSourceTableName(String t) {
 		sourceTableName = t;
 	}
 
@@ -959,7 +960,7 @@ public class ResultColumn extends ValueN
 	 * Set the column source's schema name
 	 * @param s The source schema name
 	 */
-	public void setSourceSchemaName(String s) {
+    void setSourceSchemaName(String s) {
 		sourceSchemaName = s;
 	}
 
@@ -978,7 +979,8 @@ public class ResultColumn extends ValueN
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ValueNode preprocess(int numTables,
+    @Override
+    ValueNode preprocess(int numTables,
 								FromList outerFromList,
 								SubqueryList outerSubqueryList,
 								PredicateList outerPredicateList) 
@@ -1003,7 +1005,7 @@ public class ResultColumn extends ValueN
 
 		@exception StandardException thrown if types not suitable.
 	 */
-	public void checkStorableExpression(ResultColumn toStore)
+    void checkStorableExpression(ResultColumn toStore)
 					throws StandardException
 	{
         checkStorableExpression((ValueNode) toStore);
@@ -1033,7 +1035,7 @@ public class ResultColumn extends ValueN
 
 		@exception StandardException thrown if types not suitable.
 	 */
-	public void checkStorableExpression()
+    void checkStorableExpression()
 					throws StandardException
 	{
         checkStorableExpression(getExpression());
@@ -1049,7 +1051,7 @@ public class ResultColumn extends ValueN
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
     void generateExpression(ExpressionClassBuilder ecb, MethodBuilder mb)
 									throws StandardException
 	{
@@ -1068,7 +1070,7 @@ public class ResultColumn extends ValueN
 	 * @exception StandardException		Thrown on error
 	 */
 /*PUSHCOMPILE
-	public void generateNulls(ExpressionClassBuilder acb,
+    void generateNulls(ExpressionClassBuilder acb,
 									MethodBuilder mb,
 									Expression getColumnExpress) 
 			throws StandardException
@@ -1283,7 +1285,7 @@ public class ResultColumn extends ValueN
 	 *
 	 * @return Boolean - whether or not this column is a generated column.
 	 */
-	public boolean isGenerated()
+    boolean isGenerated()
 	{
 		return (isGenerated == true);
 	}
@@ -1293,7 +1295,7 @@ public class ResultColumn extends ValueN
 	 *
 	 * @return Boolean - whether or not this columm was generated for an unmatched column in an insert.
 	 */
-	public boolean isGeneratedForUnmatchedColumnInInsert()
+    boolean isGeneratedForUnmatchedColumnInInsert()
 	{
 		return (isGeneratedForUnmatchedColumnInInsert == true);
 	}
@@ -1301,7 +1303,7 @@ public class ResultColumn extends ValueN
 	/**
 	 * Mark this a columm as a generated column
 	 */
-	public void markGenerated()
+    void markGenerated()
 	{
 		isGenerated = true;
 		/* A generated column is a referenced column */
@@ -1311,7 +1313,7 @@ public class ResultColumn extends ValueN
 	/**
 	 * Mark this a columm as generated for an unmatched column in an insert
 	 */
-	public void markGeneratedForUnmatchedColumnInInsert()
+    void markGeneratedForUnmatchedColumnInInsert()
 	{
 		isGeneratedForUnmatchedColumnInInsert = true;
 		/* A generated column is a referenced column */
@@ -1323,7 +1325,7 @@ public class ResultColumn extends ValueN
 	 *
 	 * @return Boolean - whether or not this column is a referenced column.
 	 */
-	public boolean isReferenced()
+    boolean isReferenced()
 	{
 		return isReferenced;
 	}
@@ -1331,7 +1333,7 @@ public class ResultColumn extends ValueN
 	/**
 	 * Mark this column as a referenced column.
 	 */
-	public void setReferenced()
+    void setReferenced()
 	{
 		isReferenced = true;
 	}
@@ -1361,7 +1363,7 @@ public class ResultColumn extends ValueN
 	/**
 	 * Mark this column as an unreferenced column.
 	 */
-	public void setUnreferenced()
+    void setUnreferenced()
 	{
 		isReferenced = false;
 	}
@@ -1390,7 +1392,7 @@ public class ResultColumn extends ValueN
 	 *
 	 * @return Boolean - whether or not this RC is redundant.
 	 */
-	public boolean isRedundant()
+    boolean isRedundant()
 	{
 		return isRedundant;
 	}
@@ -1398,7 +1400,7 @@ public class ResultColumn extends ValueN
 	/**
 	 * Mark this ResultColumn as redundant.
 	 */
-	public void setRedundant()
+    void setRedundant()
 	{
 		isRedundant = true;
 	}
@@ -1406,7 +1408,7 @@ public class ResultColumn extends ValueN
 	/**
 	 * Mark this ResultColumn as a grouping column in the SELECT list
 	 */
-	public void markAsGroupingColumn()
+    void markAsGroupingColumn()
 	{
 		isGroupingColumn = true;
 	}
@@ -1428,15 +1430,15 @@ public class ResultColumn extends ValueN
 	/*
 	** The following methods implement the Comparable interface.
 	*/
-	public int compareTo(Object other)
+    public int compareTo(ResultColumn other)
 	{
-		ResultColumn otherResultColumn = (ResultColumn) other;
+        ResultColumn otherResultColumn = other;
 
 		return this.getColumnPosition() - otherResultColumn.getColumnPosition();
 	}
 
 	/**
-	 * Mark this column as being updated by an update statemment.
+     * Mark this column as being updated by an update statement.
 	 */
 	void markUpdated()
 	{
@@ -1467,6 +1469,7 @@ public class ResultColumn extends ValueN
 	 *
 	 * @return	true means this column is updatable
 	 */
+    @Override
 	public boolean updatableByCursor()
 	{
 		return updatableByCursor;
@@ -1503,21 +1506,14 @@ public class ResultColumn extends ValueN
 		/* If a columnDescriptor exists, then we must propagate it */
 		if (columnDescriptor != null)
 		{
-			newResultColumn = (ResultColumn) getNodeFactory().getNode(
-													C_NodeTypes.RESULT_COLUMN,
-													columnDescriptor,
-													expression,
-													getContextManager());
+            newResultColumn = new ResultColumn(
+                    columnDescriptor, expression, getContextManager());
 			newResultColumn.setExpression(cloneExpr);
 		}
 		else
 		{
-
-			newResultColumn = (ResultColumn) getNodeFactory().getNode(
-													C_NodeTypes.RESULT_COLUMN,
-													getName(),
-													cloneExpr,
-													getContextManager());
+            newResultColumn = new ResultColumn(
+                    getName(), cloneExpr, getContextManager());
 		}
 
 		/* Set the VirtualColumnId and name in the new node */
@@ -1579,12 +1575,13 @@ public class ResultColumn extends ValueN
 	 *
 	 * @return the max size
 	 */
-	public int getMaximumColumnSize()
+    int getMaximumColumnSize()
 	{
 		return getTypeServices().getTypeId()
 			.getApproximateLengthInBytes(getTypeServices());
 	}
     
+    @Override
     public DataTypeDescriptor getTypeServices()
     {
         DataTypeDescriptor type = super.getTypeServices();
@@ -1610,6 +1607,7 @@ public class ResultColumn extends ValueN
 	 * @return	The variant type for the underlying expression.
 	 * @exception StandardException	thrown on error
 	 */
+    @Override
 	protected int getOrderableVariantType() throws StandardException
 	{
 		/*
@@ -1649,6 +1647,7 @@ public class ResultColumn extends ValueN
 	 *
 	 * @exception StandardException on error
 	 */
+    @Override
 	void acceptChildren(Visitor v)
 		throws StandardException
 	{
@@ -1692,17 +1691,17 @@ public class ResultColumn extends ValueN
 	 * Returns true if this result column is a placeholder for a generated
 	 * autoincrement value.
 	 */
-	public boolean isAutoincrementGenerated()
+    boolean isAutoincrementGenerated()
 	{
 		return autoincrementGenerated;
 	}
 
-	public void setAutoincrementGenerated()
+    void setAutoincrementGenerated()
 	{
 		autoincrementGenerated = true;
 	}
 
-	public void resetAutoincrementGenerated()
+    void resetAutoincrementGenerated()
 	{
 		autoincrementGenerated = false;
 	}
@@ -1712,7 +1711,7 @@ public class ResultColumn extends ValueN
 		return autoincrement;
   	}
 
-  	public void setAutoincrement()
+    void setAutoincrement()
   	{
   		autoincrement = true;
   	}
@@ -1796,7 +1795,7 @@ public class ResultColumn extends ValueN
 	 * @return a BaseColumnNode,
 	 *   or null if a BaseColumnNode cannot be found
 	 */
-	public BaseColumnNode getBaseColumnNode() {
+    BaseColumnNode getBaseColumnNode() {
 		ValueNode vn = expression;
 		while (true) {
 			if (vn instanceof ResultColumn) {
@@ -1831,7 +1830,7 @@ public class ResultColumn extends ValueN
 	 * @return The number of the table to which this ResultColumn	
 	 *  points, or -1 if we can't determine that from where we are.
 	 */
-	public int getTableNumber()
+    int getTableNumber()
 		throws StandardException
 	{
 		if (expression instanceof ColumnReference)
@@ -1858,7 +1857,7 @@ public class ResultColumn extends ValueN
 		return -1;
 	}
 	
-	public boolean isEquivalent(ValueNode o) throws StandardException 
+    boolean isEquivalent(ValueNode o) throws StandardException
 	{
         if (o.getNodeType() == getNodeType()) 
         {                



Mime
View raw message