db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r1333356 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/sql/dictionary/ impl/sql/compile/ impl/sql/execute/
Date Thu, 03 May 2012 08:30:34 GMT
Author: kristwaa
Date: Thu May  3 08:30:33 2012
New Revision: 1333356

URL: http://svn.apache.org/viewvc?rev=1333356&view=rev
Log:
DERBY-5737: Remove GenericDescriptorList.elements and replace Enumerator usage with Iterator

Removed elements-methods and use of Enumerator in preparation of refactoring.

Patch file: derby-5737-1a-iterator.diff

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/GenericDescriptorList.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.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/UpdateNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DropTableConstantAction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TriggerInfo.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/GenericDescriptorList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/GenericDescriptorList.java?rev=1333356&r1=1333355&r2=1333356&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/GenericDescriptorList.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/GenericDescriptorList.java
Thu May  3 08:30:33 2012
@@ -21,18 +21,6 @@
 
 package org.apache.derby.iapi.sql.dictionary;
 
-import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.catalog.UUID;
-
-import org.apache.derby.iapi.sql.dictionary.DataDictionary;
-import org.apache.derby.iapi.sql.dictionary.UniqueTupleDescriptor;
-import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
-
-import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
 import org.apache.derby.catalog.UUID;
 
 import java.util.ArrayList;
@@ -86,8 +74,4 @@ public class GenericDescriptorList exten
 		}
 		return null;
 	}
-
-	public java.util.Enumeration elements() {
-		return java.util.Collections.enumeration(this);
-	}
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java?rev=1333356&r1=1333355&r2=1333356&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
Thu May  3 08:30:33 2012
@@ -687,17 +687,13 @@ public class TableDescriptor extends Tup
 		}
 
 		DataDictionary				dd = getDataDictionary();
-		Enumeration descs = dd.getTriggerDescriptors(this).elements();
-
-		while (descs.hasMoreElements())
-		{
-			TriggerDescriptor tgr = (TriggerDescriptor)descs.nextElement();
-
-			if (tgr.needsToFire(statementType, changedColumnIds))
-			{
-				relevantTriggers.add(tgr);
-			}
-		}
+        for (Iterator descIter = dd.getTriggerDescriptors(this).iterator() ;
+                descIter.hasNext() ; ) {
+            TriggerDescriptor tgr = (TriggerDescriptor)descIter.next();
+            if (tgr.needsToFire(statementType, changedColumnIds)) {
+                relevantTriggers.add(tgr);
+            }
+        }
 	}
 
     /**

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=1333356&r1=1333355&r2=1333356&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
Thu May  3 08:30:33 2012
@@ -21,8 +21,8 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import java.util.Enumeration;
 import java.util.Hashtable;
+import java.util.Iterator;
 import java.util.Vector;
 
 import org.apache.derby.catalog.DefaultInfo;
@@ -1148,26 +1148,18 @@ abstract class DMLModStatementNode exten
 	{
 		CompilerContext 			compilerContext = getCompilerContext();
 
-		Enumeration descs = tdl.elements();
-
-		while (descs.hasMoreElements())
-		{
-			TriggerDescriptor td = (TriggerDescriptor)descs.nextElement();
-
-			/*
-			** The dependent now depends on this trigger. 
-			** the default dependent is the statement 
-			** being compiled.
-			*/
-			if (dependent == null) 
-			{ 
-				compilerContext.createDependency(td); 
-			}
-			else 
-			{ 
-				compilerContext.createDependency(dependent, td); 
-			}
-		}
+        for (Iterator descIter = tdl.iterator(); descIter.hasNext() ; ) {
+            TriggerDescriptor td = (TriggerDescriptor)descIter.next();
+            /*
+            ** The dependent now depends on this trigger.
+            ** The default dependent is the statement being compiled.
+            */
+            if (dependent == null) {
+                compilerContext.createDependency(td);
+            } else {
+                compilerContext.createDependency(dependent, td);
+            }
+        }
 	}
 
 	/**

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=1333356&r1=1333355&r2=1333356&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 Thu
May  3 08:30:33 2012
@@ -72,9 +72,9 @@ import java.lang.reflect.Modifier;
 import org.apache.derby.iapi.services.classfile.VMOpcode;
 import org.apache.derby.iapi.services.io.FormatableProperties;
 
-import java.util.Enumeration;
 import java.util.Vector;
 import java.util.Hashtable;
+import java.util.Iterator;
 import java.util.Properties;
 import org.apache.derby.iapi.sql.compile.NodeFactory;
 import org.apache.derby.iapi.util.ReuseFactory;
@@ -979,10 +979,9 @@ public class DeleteNode extends DMLModSt
 			needsDeferredProcessing[0] = true;
 			
 			boolean needToIncludeAllColumns = false;
-			Enumeration descs = relevantTriggers.elements();
-			while (descs.hasMoreElements())
-			{
-				TriggerDescriptor trd = (TriggerDescriptor) descs.nextElement();
+            for (Iterator descIter = relevantTriggers.iterator();
+                    descIter.hasNext(); ) {
+                TriggerDescriptor trd = (TriggerDescriptor)descIter.next();
 				//Does this trigger have REFERENCING clause defined on it.
 				//If yes, then read all the columns from the trigger table.
 				if (!trd.getReferencingNew() && !trd.getReferencingOld())

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=1333356&r1=1333355&r2=1333356&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 Thu
May  3 08:30:33 2012
@@ -66,8 +66,8 @@ import org.apache.derby.iapi.util.ReuseF
 import org.apache.derby.iapi.services.classfile.VMOpcode;
 
 import java.lang.reflect.Modifier;
-import java.util.Enumeration;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.Vector;
 
 /**
@@ -1101,10 +1101,9 @@ public final class UpdateNode extends DM
 			// go back to the older release if that's what the user chooses
 			// after the soft-upgrade.
 			boolean in10_9_orHigherVersion = dd.checkVersion(DataDictionary.DD_VERSION_DERBY_10_9,null);
-			Enumeration descs = relevantTriggers.elements();
-			while (descs.hasMoreElements())
-			{
-				TriggerDescriptor trd = (TriggerDescriptor) descs.nextElement();
+            for (Iterator descIter = relevantTriggers.iterator();
+                    descIter.hasNext(); ) {
+                TriggerDescriptor trd = (TriggerDescriptor) descIter.next();
 				if (in10_9_orHigherVersion) {
 					// See if we can avoid reading all the columns from the
 					// trigger table.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java?rev=1333356&r1=1333355&r2=1333356&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
Thu May  3 08:30:33 2012
@@ -22,7 +22,6 @@
 package org.apache.derby.impl.sql.execute;
 
 import java.util.ArrayList;
-import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
@@ -1374,10 +1373,8 @@ class AlterTableConstantAction extends D
 		//being dropped is part of it's trigger columns or trigger action 
 		//columns which are used through REFERENCING clause
 		GenericDescriptorList tdl = dd.getTriggerDescriptors(td);
-		Enumeration descs = tdl.elements();
-		while (descs.hasMoreElements())
-		{
-			TriggerDescriptor trd = (TriggerDescriptor) descs.nextElement();
+        for (Iterator descIter = tdl.iterator(); descIter.hasNext() ; ) {
+            TriggerDescriptor trd = (TriggerDescriptor)descIter.next();
 			//If we find that the trigger is dependent on the column being 
 			//dropped because column is part of trigger columns list, then
 			//we will give a warning or drop the trigger based on whether
@@ -2318,10 +2315,8 @@ class AlterTableConstantAction extends D
 
 		//truncate is not allowed when there are enabled DELETE triggers
 		GenericDescriptorList tdl = dd.getTriggerDescriptors(td);
-		Enumeration descs = tdl.elements();
-		while (descs.hasMoreElements())
-		{
-			TriggerDescriptor trd = (TriggerDescriptor) descs.nextElement();
+        for (Iterator descIter = tdl.iterator(); descIter.hasNext(); ) {
+            TriggerDescriptor trd = (TriggerDescriptor)descIter.next();
 			if (trd.listensForEvent(TriggerDescriptor.TRIGGER_EVENT_DELETE) &&
 				trd.isEnabled())
 			{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DropTableConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DropTableConstantAction.java?rev=1333356&r1=1333355&r2=1333356&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DropTableConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DropTableConstantAction.java
Thu May  3 08:30:33 2012
@@ -51,7 +51,7 @@ import org.apache.derby.iapi.store.acces
 
 import org.apache.derby.catalog.UUID;
 
-import java.util.Enumeration;
+import java.util.Iterator;
 
 /**
  *	This class  describes actions that are ALWAYS performed for a
@@ -188,10 +188,8 @@ class DropTableConstantAction extends DD
 
 		/* Drop the triggers */
 		GenericDescriptorList tdl = dd.getTriggerDescriptors(td);
-		Enumeration descs = tdl.elements();
-		while (descs.hasMoreElements())
-		{
-			TriggerDescriptor trd = (TriggerDescriptor) descs.nextElement();
+        for (Iterator descIter = tdl.iterator(); descIter.hasNext(); ) {
+            TriggerDescriptor trd = (TriggerDescriptor)descIter.next();
             trd.drop(lcc);
 		}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TriggerInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TriggerInfo.java?rev=1333356&r1=1333355&r2=1333356&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TriggerInfo.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TriggerInfo.java Thu
May  3 08:30:33 2012
@@ -40,7 +40,7 @@ import org.apache.derby.catalog.UUID;
 import java.io.ObjectOutput;
 import java.io.ObjectInput;
 import java.io.IOException;
-import java.util.Enumeration;
+import java.util.Iterator;
 
 import java.util.Vector;
 
@@ -118,14 +118,14 @@ public final class TriggerInfo implement
 		/*
 		** Copy the trigger descriptors into an array of the right type
 		*/
-		Enumeration descs =  triggers.elements();
+        Iterator descIter = triggers.iterator();
 		
 		int size = triggers.size();
 		triggerArray = new TriggerDescriptor[size];
 
 		for (int i = 0; i < size; i++)
 		{
-			triggerArray[i] = (TriggerDescriptor) descs.nextElement();
+            triggerArray[i] = (TriggerDescriptor) descIter.next();
 		}
 	}
 



Mime
View raw message