You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2013/04/07 14:02:56 UTC

svn commit: r1465368 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/

Author: kahatlen
Date: Sun Apr  7 12:02:50 2013
New Revision: 1465368

URL: http://svn.apache.org/r1465368
Log:
DERBY-6075: Use modern collections in impl/sql/compile

Rename variables that have "vector" in their names and update
comments.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnOrdering.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DistinctNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IndexToBaseRowNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowOrderingImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SingleChildResultSetNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnOrdering.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnOrdering.java?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnOrdering.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnOrdering.java Sun Apr  7 12:02:50 2013
@@ -28,16 +28,16 @@ import org.apache.derby.iapi.util.ReuseF
 
 class ColumnOrdering {
 
-	/* See RowOrdering for possible values */
+    /** See {@link RowOrdering} for possible values. */
 	int	myDirection;
 
-	/* A vector of column numbers (Integers) */
+    /** A list of column numbers (Integers). */
     private final ArrayList columns = new ArrayList();
 
-	/*
-	** A vector of table numbers (Integers), corresponding to the column
-	** vector by position.
-	*/
+    /**
+     * A list of table numbers (Integers), corresponding to the {@code columns}
+     * list by position.
+     */
     private final ArrayList tables = new ArrayList();
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java Sun Apr  7 12:02:50 2013
@@ -876,7 +876,7 @@ abstract class DMLModStatementNode exten
     )
 		throws StandardException
 	{
-		ArrayList							fkVector = new ArrayList();
+        ArrayList                           fkList = new ArrayList();
 		int 								type;
 		UUID[] 								uuids = null;
 		long[] 								conglomNumbers = null;
@@ -987,7 +987,7 @@ abstract class DMLModStatementNode exten
 			ConglomerateDescriptor pkIndexConglom = pktd.getConglomerateDescriptor(pkuuid);
 
 			TableDescriptor refTd = cd.getTableDescriptor();
-			fkVector.add(new FKInfo(
+            fkList.add(new FKInfo(
 									fkNames,							// foreign key names
 									refTd.getName(),				// table being modified
 									statementType,						// INSERT|UPDATE|DELETE
@@ -1004,14 +1004,12 @@ abstract class DMLModStatementNode exten
 
 		}
 		
-		/*
-		** Now convert the vector into an array.
-		*/
-        if (!fkVector.isEmpty()) {
-            fkInfo = (FKInfo[]) fkVector.toArray(new FKInfo[fkVector.size()]);
+        // Now convert the list into an array.
+        if (!fkList.isEmpty()) {
+            fkInfo = (FKInfo[]) fkList.toArray(new FKInfo[fkList.size()]);
         }
 
-		//convert the ref action info vectors to  to arrays
+        // Convert the ref action info lists to arrays.
 		int size = refActions.size();
 		if (size > 0)
 		{
@@ -1686,11 +1684,12 @@ abstract class DMLModStatementNode exten
 	)
 					throws StandardException
 	{
-		ArrayList conglomVector = new ArrayList();
+        ArrayList conglomerates = new ArrayList();
 
-		DMLModStatementNode.getXAffectedIndexes(td, updatedColumns, colBitSet, conglomVector );
+        DMLModStatementNode.getXAffectedIndexes(
+                td, updatedColumns, colBitSet, conglomerates);
 
-		markAffectedIndexes( conglomVector );
+        markAffectedIndexes(conglomerates);
 	}
 	/**
 	  *	Marks which indexes are affected by an UPDATE of the
@@ -1705,7 +1704,7 @@ abstract class DMLModStatementNode exten
 	  *
 	  *	@param	updatedColumns	a list of updated columns
 	  *	@param	colBitSet		OUT: evolving bitmap of affected columns
-	  *	@param	conglomVector	OUT: vector of affected indices
+      * @param  conglomerates   OUT: list of affected indices
 	  *
 	  * @exception StandardException		Thrown on error
 	  */
@@ -1713,8 +1712,8 @@ abstract class DMLModStatementNode exten
 	(
 		TableDescriptor		baseTable,
 		ResultColumnList	updatedColumns,
-		FormatableBitSet				colBitSet,
-		List				conglomVector
+        FormatableBitSet    colBitSet,
+        List                conglomerates
 	)
 		throws StandardException
 	{
@@ -1741,7 +1740,7 @@ abstract class DMLModStatementNode exten
 					cd.getIndexDescriptor().baseColumnPositions())))
 			{ continue; }
 
-			if ( conglomVector != null )
+            if ( conglomerates != null )
 			{
 				int i;
 				for (i = 0; i < distinctCount; i++)
@@ -1752,7 +1751,7 @@ abstract class DMLModStatementNode exten
 				if (i == distinctCount)		// first appearence
 				{
 					distinctConglomNums[distinctCount++] = cd.getConglomerateNumber();
-					conglomVector.add( cd );
+                    conglomerates.add( cd );
 				}
 			}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java Sun Apr  7 12:02:50 2013
@@ -690,12 +690,13 @@ public class DeleteNode extends DMLModSt
 		boolean[]	needsDeferredProcessing = new boolean[1];
 		needsDeferredProcessing[0] = requiresDeferredProcessing();
 
-		ArrayList conglomVector = new ArrayList();
+        ArrayList conglomerates = new ArrayList();
 		relevantTriggers = new GenericDescriptorList();
 
-		FormatableBitSet	columnMap = DeleteNode.getDeleteReadMap(baseTable,conglomVector, relevantTriggers, needsDeferredProcessing);
-		
-		markAffectedIndexes( conglomVector );
+        FormatableBitSet columnMap = DeleteNode.getDeleteReadMap(baseTable,
+                conglomerates, relevantTriggers, needsDeferredProcessing);
+
+        markAffectedIndexes(conglomerates);
 
 		adjustDeferredFlag( needsDeferredProcessing[0] );
 
@@ -901,7 +902,7 @@ public class DeleteNode extends DMLModSt
 	  *      reference.
 	  *	6)	adds the triggers to an evolving list of triggers
 	  *
-	  *	@param	conglomVector		OUT: vector of affected indices
+      * @param  conglomerates       OUT: list of affected indices
 	  *	@param	relevantTriggers	IN/OUT. Passed in as an empty list. Filled in as we go.
 	  *	@param	needsDeferredProcessing			IN/OUT. true if the statement already needs
 	  *											deferred processing. set while evaluating this
@@ -915,7 +916,7 @@ public class DeleteNode extends DMLModSt
 	private static FormatableBitSet getDeleteReadMap
 	(
 		TableDescriptor				baseTable,
-		List						conglomVector,
+        List                        conglomerates,
 		GenericDescriptorList		relevantTriggers,
 		boolean[]					needsDeferredProcessing
 	)
@@ -939,7 +940,8 @@ public class DeleteNode extends DMLModSt
 		** Adding indexes also takes care of the replication 
 		** requirement of having the primary key.
 		*/
-		DMLModStatementNode.getXAffectedIndexes(baseTable,  null, columnMap, conglomVector );
+        DMLModStatementNode.getXAffectedIndexes(
+                baseTable, null, columnMap, conglomerates);
 
 		/*
 	 	** If we have any DELETE triggers, then do one of the following

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DistinctNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DistinctNode.java?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DistinctNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DistinctNode.java Sun Apr  7 12:02:50 2013
@@ -249,12 +249,12 @@ public class DistinctNode extends Single
 	 *
 	 * @param	crs					The specified ColumnReference[]
 	 * @param	permuteOrdering		Whether or not the order of the CRs in the array can be permuted
-	 * @param	fbtVector			Vector that is to be filled with the FromBaseTable	
+     * @param   fbtHolder           List that is to be filled with the FromBaseTable
 	 *
 	 * @return	Whether the underlying ResultSet tree
 	 * is ordered on the specified column.
 	 */
-	boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, List fbtVector)
+    boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, List fbtHolder)
 	{
 		/* RESOLVE - DistinctNodes are ordered on their RCLs.
 		 * Walk RCL to see if cr is 1st non-constant column in the

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java Sun Apr  7 12:02:50 2013
@@ -4289,14 +4289,14 @@ public class FromBaseTable extends FromT
 	 *
 	 * @param	crs					The specified ColumnReference[]
 	 * @param	permuteOrdering		Whether or not the order of the CRs in the array can be permuted
-	 * @param	fbtVector			Vector that is to be filled with the FromBaseTable	
+     * @param   fbtHolder           List that is to be filled with the FromBaseTable
 	 *
 	 * @return	Whether the underlying ResultSet tree
 	 * is ordered on the specified column.
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, List fbtVector)
+    boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, List fbtHolder)
 				throws StandardException
 	{
 		/* The following conditions must be met, regardless of the value of permuteOrdering,
@@ -4330,9 +4330,9 @@ public class FromBaseTable extends FromT
 			isOrdered = isStrictlyOrdered(crs, cd);
 		}
 
-		if (fbtVector != null)
+        if (fbtHolder != null)
 		{
-			fbtVector.add(this);
+            fbtHolder.add(this);
 		}
 
 		return isOrdered;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java Sun Apr  7 12:02:50 2013
@@ -1407,7 +1407,7 @@ abstract class FromTable extends ResultS
 	 * FromBaseTable that match the columns in the given update column list.
 	 * If the list is null, it means all the columns are updatable.
 	 *
-	 * @param updateColumns		A Vector representing the columns
+     * @param updateColumns     A list representing the columns
 	 *							that can be updated.
 	 */
 	protected void markUpdatableByCursor(List updateColumns)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java Sun Apr  7 12:02:50 2013
@@ -1248,12 +1248,14 @@ public class GroupByNode extends SingleC
 
                         // Holder list for the FromBaseTable. We expect no more
                         // than one table, hence initial capacity is 1.
-						ArrayList tableVector = new ArrayList(1);
+                        ArrayList fbtHolder = new ArrayList(1);
 
-						boolean minMaxOptimizationPossible = isOrderedOn(crs, false, tableVector);
+                        boolean minMaxOptimizationPossible = isOrderedOn(crs, false, fbtHolder);
 						if (SanityManager.DEBUG)
 						{
-							SanityManager.ASSERT(tableVector.size() <= 1, "bad number of FromBaseTables returned by isOrderedOn() -- "+tableVector.size());
+                            SanityManager.ASSERT(fbtHolder.size() <= 1,
+                                "bad number of FromBaseTables returned by isOrderedOn() -- " +
+                                fbtHolder.size());
 						}
 
 						if (minMaxOptimizationPossible)
@@ -1292,7 +1294,7 @@ public class GroupByNode extends SingleC
 							}
 
                             FromBaseTable fbt =
-                                    (FromBaseTable) tableVector.get(0);
+                                    (FromBaseTable) fbtHolder.get(0);
 							MaxMinAggregateDefinition temp = (MaxMinAggregateDefinition)ad;
 
 							/*  MAX   ASC      NULLABLE 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IndexToBaseRowNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IndexToBaseRowNode.java?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IndexToBaseRowNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IndexToBaseRowNode.java Sun Apr  7 12:02:50 2013
@@ -128,17 +128,17 @@ public class IndexToBaseRowNode extends 
 	 *
 	 * @param	crs					The specified ColumnReference[]
 	 * @param	permuteOrdering		Whether or not the order of the CRs in the array can be permuted
-	 * @param	fbtVector			Vector that is to be filled with the FromBaseTable	
+     * @param   fbtHolder           List that is to be filled with the FromBaseTable
 	 *
 	 * @return	Whether the underlying ResultSet tree
 	 * is ordered on the specified column.
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, List fbtVector)
+    boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, List fbtHolder)
 				throws StandardException
 	{
-		return source.isOrderedOn(crs, permuteOrdering, fbtVector);
+        return source.isOrderedOn(crs, permuteOrdering, fbtHolder);
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java Sun Apr  7 12:02:50 2013
@@ -1894,18 +1894,18 @@ public class JoinNode extends TableOpera
 	 *
 	 * @param	crs					The specified ColumnReference[]
 	 * @param	permuteOrdering		Whether or not the order of the CRs in the array can be permuted
-	 * @param	fbtVector			Vector that is to be filled with the FromBaseTable	
+     * @param   fbtHolder           List that is to be filled with the FromBaseTable
 	 *
 	 * @return	Whether the underlying ResultSet tree
 	 * is ordered on the specified column.
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, List fbtVector)
+    boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, List fbtHolder)
 				throws StandardException
 	{
 		/* RESOLVE - easiest thing for now is to only consider the leftmost child */
-		return leftResultSet.isOrderedOn(crs, permuteOrdering, fbtVector);
+        return leftResultSet.isOrderedOn(crs, permuteOrdering, fbtHolder);
 	}
 
 	/**

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=1465368&r1=1465367&r2=1465368&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 Sun Apr  7 12:02:50 2013
@@ -542,7 +542,7 @@ public class PredicateList extends Query
 			** they don't have to be in any order.
 			**
 			** NOTE: We can logically delete the current element when
-			** traversing the Vector in the next loop,
+            ** traversing the list in the next loop,
 			** so we must build an array of elements to
 			** delete while looping and then delete them
 			** in reverse order after completing the loop.
@@ -4011,7 +4011,7 @@ public class PredicateList extends Query
 		PredicateWrapperList pwl = predArray[position];
 		List uniquepreds = pwl.createLeadingUnique();
 		
-		/* uniqueprds is a vector of predicate (along with wrapper) that I'm
+        /* 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
 		   predicates from all the predicateWrapperLists!
 		*/

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java Sun Apr  7 12:02:50 2013
@@ -2863,7 +2863,7 @@ public class ResultColumnList extends Qu
 	 * Mark all the columns in the select sql that this result column list represents
 	 * as updatable if they match the columns in the given update column list.
 	 *
-	 * @param updateColumns		A Vector representing the columns
+     * @param updateColumns     A list representing the columns
 	 *							to be updated.
 	 */
 	void markColumnsInSelectListUpdatableByCursor(List updateColumns)
@@ -2925,7 +2925,7 @@ public class ResultColumnList extends Qu
 	 * Mark as updatable all the columns in this result column list
 	 * that match the columns in the given update column list
 	 *
-	 * @param updateColumns		A Vector representing the columns
+     * @param updateColumns     A list representing the columns
 	 *							to be updated.
 	 */
 	void markUpdatableByCursor(List updateColumns)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java Sun Apr  7 12:02:50 2013
@@ -1736,14 +1736,14 @@ public abstract class ResultSetNode exte
 	 *
 	 * @param	crs					The specified ColumnReference[]
 	 * @param	permuteOrdering		Whether or not the order of the CRs in the array can be permuted
-	 * @param	fbtVector			Vector that is to be filled with the FromBaseTable
+     * @param   fbtHolder           List that is to be filled with the FromBaseTable
 	 *
 	 * @return	Whether the underlying ResultSet tree
 	 * is ordered on the specified column.
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, List fbtVector)
+    boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, List fbtHolder)
 				throws StandardException
 	{
 		return false;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowOrderingImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowOrderingImpl.java?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowOrderingImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowOrderingImpl.java Sun Apr  7 12:02:50 2013
@@ -22,6 +22,7 @@
 package org.apache.derby.impl.sql.compile;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 
 import org.apache.derby.iapi.sql.compile.RowOrdering;
 import org.apache.derby.iapi.sql.compile.Optimizable;
@@ -32,7 +33,7 @@ import org.apache.derby.iapi.error.Stand
 
 class RowOrderingImpl implements RowOrdering {
 
-	/* This vector contains ColumnOrderings */
+    /** List of ColumnOrderings. */
 	private final ArrayList ordering = new ArrayList();
 
 	/*
@@ -45,15 +46,15 @@ class RowOrderingImpl implements RowOrde
 	*/
 	ColumnOrdering	columnsAlwaysOrdered;
 
-	/*
-	** This vector contains table numbers for tables that are always ordered.
-	** This happens for one-row tables.
-	*/
+    /**
+     * List of table numbers for tables that are always ordered.
+     * This happens for one-row tables.
+     */
     private final ArrayList alwaysOrderedOptimizables = new ArrayList();
 
 	ColumnOrdering	currentColumnOrdering;
 
-	/* This vector contains unordered Optimizables */
+    /** List of unordered Optimizables. */
     private final ArrayList unorderedOptimizables = new ArrayList();
 
 	RowOrderingImpl() {
@@ -79,7 +80,7 @@ class RowOrderingImpl implements RowOrde
 		/*
 		** Return true if the table is always ordered.
 		*/
-		if (vectorContainsOptimizable(tableNumber, alwaysOrderedOptimizables))
+        if (alwaysOrdered(tableNumber))
 		{
 			return true;
 		}
@@ -120,7 +121,7 @@ class RowOrderingImpl implements RowOrde
 		/*
 		** Return true if the table is always ordered.
 		*/
-		if (vectorContainsOptimizable(tableNumber, alwaysOrderedOptimizables))
+        if (alwaysOrdered(tableNumber))
 		{
 			return true;
 		}
@@ -154,31 +155,6 @@ class RowOrderingImpl implements RowOrde
 		return ordered;
 	}
 
-	/**
-	 * Return true if the given vector of Optimizables contains an Optimizable
-	 * with the given table number.
-	 */
-	private boolean vectorContainsOptimizable(int tableNumber, ArrayList vec)
-	{
-		int i;
-
-		for (i = vec.size() - 1; i >= 0; i--)
-		{
-			Optimizable optTable =
-							(Optimizable) vec.get(i);
-
-			if (optTable.hasTableNumber())
-			{
-				if (optTable.getTableNumber() == tableNumber)
-				{
-					return true;
-				}
-			}
-		}
-
-		return false;
-	}
-
 	/** @see RowOrdering#addOrderedColumn */
 	public void addOrderedColumn(int direction,
 								int tableNumber,
@@ -280,10 +256,18 @@ class RowOrderingImpl implements RowOrde
 	/** @see RowOrdering#alwaysOrdered */
 	public boolean alwaysOrdered(int tableNumber)
 	{
-		return vectorContainsOptimizable(
-										tableNumber,
-										alwaysOrderedOptimizables
-										);
+        Iterator it = alwaysOrderedOptimizables.iterator();
+        while (it.hasNext()) {
+            Optimizable optTable = (Optimizable) it.next();
+
+            if (optTable.hasTableNumber()) {
+                if (optTable.getTableNumber() == tableNumber) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
 	}
 
 	/** @see RowOrdering#removeOptimizable */
@@ -310,32 +294,27 @@ class RowOrderingImpl implements RowOrde
 		columnsAlwaysOrdered.removeColumns(tableNumber);
 
 		/* Also remove from list of unordered optimizables */
-		removeOptimizableFromVector(tableNumber, unorderedOptimizables);
+        removeOptimizable(tableNumber, unorderedOptimizables);
 
 		/* Also remove from list of always ordered optimizables */
-		removeOptimizableFromVector(tableNumber, alwaysOrderedOptimizables);
+        removeOptimizable(tableNumber, alwaysOrderedOptimizables);
 	}
 
 	/**
 	 * Remove all optimizables with the given table number from the
-	 * given vector of optimizables.
+     * given list of optimizables.
 	 */
-	private void removeOptimizableFromVector(int tableNumber, ArrayList vec)
+    private void removeOptimizable(int tableNumber, ArrayList list)
 	{
-		int i;
-
-		for (i = vec.size() - 1; i >= 0; i--)
+        Iterator it = list.iterator();
+        while (it.hasNext())
 		{
-			Optimizable optTable =
-							(Optimizable) vec.get(i);
+            Optimizable optTable = (Optimizable) it.next();
 
-			if (optTable.hasTableNumber())
-			{
-				if (optTable.getTableNumber() == tableNumber)
-				{
-					vec.remove(i);
-				}
-			}
+            if (optTable.hasTableNumber()
+                    && (optTable.getTableNumber() == tableNumber)) {
+                it.remove();
+            }
 		}
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SingleChildResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SingleChildResultSetNode.java?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SingleChildResultSetNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SingleChildResultSetNode.java Sun Apr  7 12:02:50 2013
@@ -492,17 +492,17 @@ abstract class SingleChildResultSetNode 
 	 *
 	 * @param	crs					The specified ColumnReference[]
 	 * @param	permuteOrdering		Whether or not the order of the CRs in the array can be permuted
-	 * @param	fbtVector			Vector that is to be filled with the FromBaseTable	
+     * @param   fbtHolder           List that is to be filled with the FromBaseTable
 	 *
 	 * @return	Whether the underlying ResultSet tree
 	 * is ordered on the specified column.
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, List fbtVector)
+    boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, List fbtHolder)
 				throws StandardException
 	{
-		return childResult.isOrderedOn(crs, permuteOrdering, fbtVector);
+        return childResult.isOrderedOn(crs, permuteOrdering, fbtHolder);
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java Sun Apr  7 12:02:50 2013
@@ -171,7 +171,7 @@ public class TableElementList extends Qu
         HashSet columnNames = new HashSet(size + 2, 0.999f);
         HashSet constraintNames = new HashSet(size + 2, 0.999f);
 		//all the primary key/unique key constraints for this table
-        ArrayList constraintsVector = new ArrayList();
+        ArrayList constraints = new ArrayList();
 
 		//special case for alter table (td is not null in case of alter table)
 		if (td != null)
@@ -191,7 +191,7 @@ public class TableElementList extends Qu
 					if (cd.getConstraintType() == DataDictionary.PRIMARYKEY_CONSTRAINT ||
 					cd.getConstraintType() == DataDictionary.UNIQUE_CONSTRAINT)
                     {
-                        constraintsVector.add(cd);
+                        constraints.add(cd);
                     }
 				}
 			}
@@ -252,11 +252,11 @@ public class TableElementList extends Qu
 
 			cdn.bind(ddlStmt, dd);
 
-			//if constraint is primary key or unique key, add it to the vector
+            // If constraint is primary key or unique key, add it to the list.
 			if (cdn.getConstraintType() == DataDictionary.PRIMARYKEY_CONSTRAINT ||
 			cdn.getConstraintType() == DataDictionary.UNIQUE_CONSTRAINT)
 			{
-				/* In case of create table, the vector can have only ConstraintDefinitionNode
+                /* In case of create table, the list can have only ConstraintDefinitionNode
 				* elements. In case of alter table, it can have both ConstraintDefinitionNode
 				* (for new constraints) and ConstraintDescriptor(for pre-existing constraints).
 				*/
@@ -265,10 +265,10 @@ public class TableElementList extends Qu
 				String destName = null;
 				String[] destColumnNames = null;
 
-				for (int i=0; i<constraintsVector.size();i++)
+                for (int i = 0; i < constraints.size(); i++)
 				{
 
-					destConstraint = constraintsVector.get(i);
+                    destConstraint = constraints.get(i);
 					if (destConstraint instanceof ConstraintDefinitionNode)
 					{
 						ConstraintDefinitionNode destCDN = (ConstraintDefinitionNode)destConstraint;
@@ -287,7 +287,7 @@ public class TableElementList extends Qu
 						throw StandardException.newException(SQLState.LANG_MULTIPLE_CONSTRAINTS_WITH_SAME_COLUMNS,
 						cdn.getConstraintMoniker(), destName);
 				}
-				constraintsVector.add(cdn);
+                constraints.add(cdn);
 			}
 
 			/* Make sure that there are no duplicate constraint names in the list */

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java Sun Apr  7 12:02:50 2013
@@ -888,16 +888,16 @@ public final class UpdateNode extends DM
 		boolean[]	needsDeferredProcessing = new boolean[1];
 		needsDeferredProcessing[0] = requiresDeferredProcessing();
 
-		ArrayList conglomVector = new ArrayList();
+        ArrayList conglomerates = new ArrayList();
 		relevantCdl = new ConstraintDescriptorList();
 		relevantTriggers =  new GenericDescriptorList();
 
 		FormatableBitSet	columnMap = getUpdateReadMap
             (
-             dd, baseTable, updateColumnList, conglomVector, relevantCdl,
+             dd, baseTable, updateColumnList, conglomerates, relevantCdl,
              relevantTriggers, needsDeferredProcessing, affectedGeneratedColumns );
 
-		markAffectedIndexes( conglomVector );
+        markAffectedIndexes(conglomerates);
 
 		adjustDeferredFlag( needsDeferredProcessing[0] );
 
@@ -971,7 +971,7 @@ public final class UpdateNode extends DM
 	  *	@param	dd	Data Dictionary
 	  *	@param	baseTable	Table on which update is issued
 	  *	@param	updateColumnList	a list of updated columns
-	  *	@param	conglomVector		OUT: vector of affected indices
+      * @param  conglomerates       OUT: list of affected indices
 	  *	@param	relevantConstraints	IN/OUT. Empty list is passed in. We hang constraints on it as we go.
 	  *	@param	relevantTriggers	IN/OUT. Passed in as an empty list. Filled in as we go.
 	  *	@param	needsDeferredProcessing	IN/OUT. true if the statement already needs
@@ -989,7 +989,7 @@ public final class UpdateNode extends DM
 		DataDictionary		dd,
 		TableDescriptor				baseTable,
 		ResultColumnList			updateColumnList,
-		List						conglomVector,
+        List                        conglomerates,
 		ConstraintDescriptorList	relevantConstraints,
 		GenericDescriptorList		relevantTriggers,
 		boolean[]					needsDeferredProcessing,
@@ -1025,7 +1025,8 @@ public final class UpdateNode extends DM
 		** columns where 1 or more columns in the index
 		** are going to be modified.
 		*/
-		DMLModStatementNode.getXAffectedIndexes(baseTable, updateColumnList, columnMap, conglomVector );
+        DMLModStatementNode.getXAffectedIndexes(
+                baseTable, updateColumnList, columnMap, conglomerates);
  
 		/* 
 		** Add all columns needed for constraints.  We don't

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj?rev=1465368&r1=1465367&r2=1465368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj Sun Apr  7 12:02:50 2013
@@ -11336,17 +11336,17 @@ rowOrStatement() :
 List
 triggerReferencingClause() throws StandardException :
 {
-	ArrayList vector = new ArrayList();
+	ArrayList expressions = new ArrayList();
 }
 {
-	<REFERENCING> triggerReferencingExpression(vector) ( triggerReferencingExpression(vector) )*
+	<REFERENCING> triggerReferencingExpression(expressions) ( triggerReferencingExpression(expressions) )*
 	{
-		return vector;
+		return expressions;
 	}
 }
 
 void
-triggerReferencingExpression(List vector) throws StandardException :
+triggerReferencingExpression(List expressions) throws StandardException :
 {
 	String	identifier;
 	boolean isNew = true;
@@ -11365,7 +11365,7 @@ triggerReferencingExpression(List vector
 
 	<AS> identifier = identifier(Limits.MAX_IDENTIFIER_LENGTH, true)
 	{
-		vector.add(new TriggerReferencingStruct(isRow, isNew, identifier));
+		expressions.add(new TriggerReferencingStruct(isRow, isNew, identifier));
 	}
 }