commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r690392 - in /commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite: BinarySequence.java Sequence.java UnarySequence.java
Date Fri, 29 Aug 2008 21:15:15 GMT
Author: mbenson
Date: Fri Aug 29 14:15:14 2008
New Revision: 690392

URL: http://svn.apache.org/viewvc?rev=690392&view=rev
Log:
can't see any semantic reason for sequences to run nested procedures in reverse of order specified

Modified:
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinarySequence.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Sequence.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnarySequence.java

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinarySequence.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinarySequence.java?rev=690392&r1=690391&r2=690392&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinarySequence.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinarySequence.java
Fri Aug 29 14:15:14 2008
@@ -18,8 +18,8 @@
 
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
-import java.util.ListIterator;
 
 import org.apache.commons.functor.BinaryProcedure;
 
@@ -88,8 +88,8 @@
      * {@inheritDoc}
      */
     public void run(L left, R right) {
-        for (ListIterator<BinaryProcedure<? super L, ? super R>> iter = list.listIterator(list.size());
iter.hasPrevious();) {
-            iter.previous().run(left, right);
+        for (Iterator<BinaryProcedure<? super L, ? super R>> iter = list.iterator();
iter.hasNext();) {
+            iter.next().run(left, right);
         }
     }
 

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Sequence.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Sequence.java?rev=690392&r1=690391&r2=690392&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Sequence.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Sequence.java
Fri Aug 29 14:15:14 2008
@@ -18,8 +18,8 @@
 
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
-import java.util.ListIterator;
 
 import org.apache.commons.functor.Procedure;
 
@@ -90,8 +90,8 @@
      * {@inheritDoc}
      */
     public void run() {
-        for (ListIterator<Procedure> iter = list.listIterator(list.size()); iter.hasPrevious();)
{
-            iter.previous().run();
+        for (Iterator<Procedure> iter = list.iterator(); iter.hasNext();) {
+            iter.next().run();
         }
     }
 

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnarySequence.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnarySequence.java?rev=690392&r1=690391&r2=690392&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnarySequence.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnarySequence.java
Fri Aug 29 14:15:14 2008
@@ -18,8 +18,8 @@
 
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
-import java.util.ListIterator;
 
 import org.apache.commons.functor.UnaryProcedure;
 
@@ -90,8 +90,8 @@
      * {@inheritDoc}
      */
     public void run(A obj) {
-        for (ListIterator<UnaryProcedure<? super A>> iter = list.listIterator(list.size());
iter.hasPrevious();) {
-            iter.previous().run(obj);
+        for (Iterator<UnaryProcedure<? super A>> iter = list.iterator(); iter.hasNext();)
{
+            iter.next().run(obj);
         }
     }
 



Mime
View raw message