db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r1497644 [4/4] - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/services/loader/ iapi/sql/compile/ impl/sql/compile/
Date Fri, 28 Jun 2013 04:32:09 GMT
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/VTIDeferModPolicy.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/VTIDeferModPolicy.java?rev=1497644&r1=1497643&r2=1497644&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/VTIDeferModPolicy.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/VTIDeferModPolicy.java
Fri Jun 28 04:32:08 2013
@@ -25,7 +25,6 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.Arrays;
 import java.util.HashSet;
-import java.util.Iterator;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.sql.compile.Visitable;
 import org.apache.derby.iapi.sql.compile.Visitor;
@@ -89,11 +88,9 @@ class VTIDeferModPolicy implements Visit
             if( statementType == DeferModification.UPDATE_STATEMENT)
             {
                 // Apply the columnRequiresDefer method to updated columns not in the where
clause.
-                Iterator columns = deferralSearch.columns.iterator();
-                while (columns.hasNext())
-                {
+                for (String s : deferralSearch.columns) {
                     if (deferralControl.columnRequiresDefer(
-                            statementType, (String) columns.next(), false)) {
+                            statementType, s, false)) {
                         return true;
                     }
                 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ValueNodeList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ValueNodeList.java?rev=1497644&r1=1497643&r2=1497644&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ValueNodeList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ValueNodeList.java Fri
Jun 28 04:32:08 2013
@@ -41,10 +41,10 @@ import org.apache.derby.iapi.util.JBitSe
  * e.g. IN list, NOT IN list or BETWEEN in a DML statement.
  */
 
-class ValueNodeList extends QueryTreeNodeVector
+class ValueNodeList extends QueryTreeNodeVector<ValueNode>
 {
     ValueNodeList(ContextManager cm) {
-        super(cm);
+        super(ValueNode.class, cm);
         setNodeType(C_NodeTypes.VALUE_NODE_LIST);
     }
 
@@ -79,7 +79,7 @@ class ValueNodeList extends QueryTreeNod
 
 		for (int index = 0; index < size; index++)
 		{
-			ValueNode vn = (ValueNode) elementAt(index);
+            ValueNode vn = elementAt(index);
             vn = vn.bindExpression(fromList, subqueryList, aggregates);
 
 			setElementAt(vn, index);
@@ -102,7 +102,7 @@ class ValueNodeList extends QueryTreeNod
 
 		for (int index = 0; index < size; index++)
 		{
-			ValueNode valueNode = (ValueNode) elementAt(index);
+            ValueNode valueNode = elementAt(index);
 			
 			if (valueNode.getTypeId().userType())
 			{
@@ -167,7 +167,7 @@ class ValueNodeList extends QueryTreeNod
 		{
 			ValueNode			valueNode;
 
-			valueNode = (ValueNode) elementAt(index);
+            valueNode = elementAt(index);
 			if (valueNode.requiresTypeFromContext())
 				continue;
 			DataTypeDescriptor valueNodeDTS = valueNode.getTypeServices();
@@ -234,7 +234,7 @@ class ValueNodeList extends QueryTreeNod
 
 		for (int index = 0; index < size; index++)
 		{
-			ValueNode valueNode = (ValueNode) elementAt(index);
+            ValueNode valueNode = elementAt(index);
 			DataTypeDescriptor valueNodeDTS = valueNode.getTypeServices();
 
 			if (valueNodeDTS != null)
@@ -264,7 +264,7 @@ class ValueNodeList extends QueryTreeNod
 		{
 			ValueNode			valueNode;
 
-			valueNode = (ValueNode) elementAt(index);
+            valueNode = elementAt(index);
 			DataTypeDescriptor valueNodeDTS = valueNode.getTypeServices();
 
 			if (valueNodeDTS == null)
@@ -290,20 +290,14 @@ class ValueNodeList extends QueryTreeNod
 	 */
     void compatible(ValueNode leftOperand) throws StandardException
 	{
-		int			 size = size();
-		TypeId	leftType;
-		ValueNode		valueNode;
-		TypeCompiler leftTC;
+        TypeId leftType = leftOperand.getTypeId();
+        TypeCompiler leftTC = leftOperand.getTypeCompiler();
 
-		leftType = leftOperand.getTypeId();
-		leftTC = leftOperand.getTypeCompiler();
-
-		for (int index = 0; index < size; index++)
+        for (ValueNode valueNode : this)
 		{
-			valueNode = (ValueNode) elementAt(index);
-			if (valueNode.requiresTypeFromContext())
+            if (valueNode.requiresTypeFromContext()) {
 				continue;
-
+            }
 
 			/*
 			** Are the types compatible to each other?  If not, throw an exception.
@@ -334,7 +328,7 @@ class ValueNodeList extends QueryTreeNod
 
 		for (int index = 0; index < size; index++)
 		{
-			valueNode = (ValueNode) elementAt(index);
+            valueNode = elementAt(index);
 
 			/*
 			** Can the types be compared to each other?  If not, throw an
@@ -365,7 +359,7 @@ class ValueNodeList extends QueryTreeNod
 
 		for (int index = 0; index < size; index++)
 		{
-			if (((ValueNode) elementAt(index)).getTypeServices().isNullable())
+            if (elementAt(index).getTypeServices().isNullable())
 			{
 				return true;
 			}
@@ -384,7 +378,7 @@ class ValueNodeList extends QueryTreeNod
 
 		for (int index = 0; index < size; index++)
 		{
-			if (((ValueNode) elementAt(index)).requiresTypeFromContext())
+            if (elementAt(index).requiresTypeFromContext())
 			{
 				return true;
 			}
@@ -403,7 +397,7 @@ class ValueNodeList extends QueryTreeNod
 
 		for (int index = 0; index < size; index++)
 		{
-			if (! (((ValueNode) elementAt(index)).requiresTypeFromContext()))
+            if (! (elementAt(index).requiresTypeFromContext()))
 			{
 				return false;
 			}
@@ -422,7 +416,7 @@ class ValueNodeList extends QueryTreeNod
 
 		for (int index = 0; index < size; index++)
 		{
-			if (! ((ValueNode) elementAt(index) instanceof ConstantNode))
+            if (! (elementAt(index) instanceof ConstantNode))
 			{
 				return false;
 			}
@@ -442,7 +436,7 @@ class ValueNodeList extends QueryTreeNod
 
 		for (int index = 0; index < size; index++)
 		{
-			ValueNode vNode = (ValueNode)elementAt(index);
+            ValueNode vNode = elementAt(index);
 			if (!vNode.requiresTypeFromContext() &&
 			    !(vNode instanceof ConstantNode))
 			{
@@ -516,7 +510,7 @@ class ValueNodeList extends QueryTreeNod
 
 		for (int index = 0; index < size; index++)
 		{
-			ValueNode valueNode = (ValueNode) elementAt(index);
+            ValueNode valueNode = elementAt(index);
 			if (valueNode.requiresTypeFromContext())
 			{
 				valueNode.setType(descriptor);
@@ -546,7 +540,7 @@ class ValueNodeList extends QueryTreeNod
 
 		for (int index = 0; index < size; index++)
 		{
-			valueNode = (ValueNode) elementAt(index);
+            valueNode = elementAt(index);
 			valueNode.preprocess(numTables,
 								 outerFromList, outerSubqueryList,
 								 outerPredicateList);
@@ -568,9 +562,8 @@ class ValueNodeList extends QueryTreeNod
 
 		for (int index = 0; index < size; index++)
 		{
-			setElementAt(
-				((ValueNode) elementAt(index)).remapColumnReferencesToExpressions(),
-				index);
+            setElementAt(elementAt(index).remapColumnReferencesToExpressions(),
+                         index);
 		}
 		return this;
 	}
@@ -593,8 +586,8 @@ class ValueNodeList extends QueryTreeNod
         }
 
         for (int i = 0; i < size(); i++) {
-            ValueNode vn1 = (ValueNode) elementAt(i);
-            ValueNode vn2 = (ValueNode) other.elementAt(i);
+            ValueNode vn1 = elementAt(i);
+            ValueNode vn2 = other.elementAt(i);
             if (!vn1.isEquivalent(vn2)) {
                 return false;
             }
@@ -616,7 +609,7 @@ class ValueNodeList extends QueryTreeNod
 		{
 			boolean retcode;
 
-			retcode = ((ValueNode) elementAt(index)).isConstantExpression();
+            retcode = elementAt(index).isConstantExpression();
 			if (! retcode)
 			{
 				return retcode;
@@ -635,8 +628,7 @@ class ValueNodeList extends QueryTreeNod
 		{
 			boolean retcode;
 
-			retcode =
-				((ValueNode) elementAt(index)).constantExpression(whereClause);
+            retcode = elementAt(index).constantExpression(whereClause);
 			if (! retcode)
 			{
 				return retcode;
@@ -683,7 +675,7 @@ class ValueNodeList extends QueryTreeNod
 
 		for (int index = 0; index < size; index++)
 		{
-			pushable = ((ValueNode) elementAt(index)).categorize(referencedTabs, simplePredsOnly)
&&
+            pushable = elementAt(index).categorize(referencedTabs, simplePredsOnly) &&
 					   pushable;
 		}
 
@@ -715,7 +707,7 @@ class ValueNodeList extends QueryTreeNod
 		 */
 		for (int index = 0; index < size; index++)
 		{
-			int curType = ((ValueNode) elementAt(index)).getOrderableVariantType();
+            int curType = elementAt(index).getOrderableVariantType();
 			listType = Math.min(listType, curType);
 		}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowDefinitionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowDefinitionNode.java?rev=1497644&r1=1497643&r2=1497644&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowDefinitionNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowDefinitionNode.java
Fri Jun 28 04:32:08 2013
@@ -112,10 +112,8 @@ public final class WindowDefinitionNode 
      * @return an existing window definition from wl, if 'this' is equivalent
      * to a window in wl.
      */
-    public WindowDefinitionNode findEquivalentWindow(WindowList wl) {
-        for (int i = 0; i < wl.size(); i++) {
-            WindowDefinitionNode old = (WindowDefinitionNode)wl.elementAt(i);
-
+    WindowDefinitionNode findEquivalentWindow(WindowList wl) {
+        for (WindowDefinitionNode old : wl) {
             if (isEquivalent(old)) {
                 return old;
             }
@@ -147,7 +145,7 @@ public final class WindowDefinitionNode 
     /**
      * @return the order by list of this window definition if any, else null.
      */
-    public OrderByList getOrderByList() {
+    OrderByList getOrderByList() {
         return orderByList;
     }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowFunctionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowFunctionNode.java?rev=1497644&r1=1497643&r2=1497644&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowFunctionNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowFunctionNode.java
Fri Jun 28 04:32:08 2013
@@ -73,7 +73,7 @@ public abstract class WindowFunctionNode
      * @see ValueNode#isConstantExpression
      */
     @Override
-    public boolean constantExpression(PredicateList whereClause)
+    boolean constantExpression(PredicateList whereClause)
     {
         // Without this, an ORDER by on ROW_NUMBER could get optimised away
         // if there is a restriction, e.g.
@@ -87,7 +87,7 @@ public abstract class WindowFunctionNode
     /**
      * @return window associated with this window function
      */
-    public WindowNode getWindow() {
+    WindowNode getWindow() {
         return window;
     }
 
@@ -96,7 +96,7 @@ public abstract class WindowFunctionNode
      * Set window associated with this window function call.
      * @param wdn window definition
      */
-    public void setWindow(WindowDefinitionNode wdn) {
+    void setWindow(WindowDefinitionNode wdn) {
         this.window = wdn;
     }
 
@@ -134,10 +134,7 @@ public abstract class WindowFunctionNode
      */
     private WindowDefinitionNode definedWindow(WindowList windows,
                                                String name) {
-        for (int i=0; i < windows.size(); i++) {
-            WindowDefinitionNode wdn =
-                (WindowDefinitionNode)windows.elementAt(i);
-
+        for (WindowDefinitionNode wdn : windows) {
             if (wdn.getName().equals(name)) {
                 return wdn;
             }
@@ -175,7 +172,7 @@ public abstract class WindowFunctionNode
      *
      * @exception StandardException         Thrown on error
      */
-    public ValueNode replaceCallsWithColumnReferences(ResultColumnList rcl,
+    ValueNode replaceCallsWithColumnReferences(ResultColumnList rcl,
                                                       int tableNumber)
         throws StandardException
     {
@@ -242,7 +239,7 @@ public abstract class WindowFunctionNode
      *
      * @return the column reference
      */
-    public ColumnReference getGeneratedRef()
+    ColumnReference getGeneratedRef()
     {
         return generatedRef;
     }
@@ -255,7 +252,7 @@ public abstract class WindowFunctionNode
      *
      * @exception StandardException on error
      */
-    public ValueNode    getNewNullResultExpression()
+    ValueNode getNewNullResultExpression()
         throws StandardException
     {
         //

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowList.java?rev=1497644&r1=1497643&r2=1497644&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowList.java Fri
Jun 28 04:32:08 2013
@@ -30,10 +30,10 @@ import org.apache.derby.iapi.services.co
  *
  */
 
-class WindowList extends OrderedColumnList
+class WindowList extends QueryTreeNodeVector<WindowDefinitionNode>
 {
     WindowList(ContextManager cm) {
-        super(cm);
+        super(WindowDefinitionNode.class, cm);
     }
 
     /**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowResultSetNode.java?rev=1497644&r1=1497643&r2=1497644&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowResultSetNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowResultSetNode.java
Fri Jun 28 04:32:08 2013
@@ -104,10 +104,8 @@ class WindowResultSetNode extends Single
         */
         ResultColumnList rclNew = new ResultColumnList(getContextManager());
 
-        int sz = resultColumns.size();
-        for (int i = 0; i < sz; i++)
+        for (ResultColumn rc : resultColumns)
         {
-            ResultColumn rc = (ResultColumn) resultColumns.elementAt(i);
             if (!rc.isGenerated()) {
                 rclNew.addElement(rc);
             }
@@ -338,7 +336,7 @@ class WindowResultSetNode extends Single
          */
 
         for (int index = rclSize-1; index >= 0; index--) {
-            ResultColumn rc = (ResultColumn) resultColumns.elementAt(index);
+            ResultColumn rc = resultColumns.elementAt(index);
             ValueNode expr = rc.getExpression();
 
             if (rc.isGenerated() &&



Mime
View raw message