jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r558173 - in /jackrabbit/branches/1.3/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/version/ test/java/org/apache/jackrabbit/core/version/
Date Fri, 20 Jul 2007 22:13:07 GMT
Author: jukka
Date: Fri Jul 20 15:13:06 2007
New Revision: 558173

URL: http://svn.apache.org/viewvc?view=rev&rev=558173
Log:
1.3: Merged revision 558167 (JCR-1006)

Added:
    jackrabbit/branches/1.3/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/
      - copied from r558167, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/
    jackrabbit/branches/1.3/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/VersionIteratorImplTest.java
      - copied unchanged from r558167, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/VersionIteratorImplTest.java
Modified:
    jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java

Modified: jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java?view=diff&rev=558173&r1=558172&r2=558173
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java
Fri Jul 20 15:13:06 2007
@@ -66,7 +66,7 @@
         this.session = (SessionImpl) session;
 
         addVersion(rootVersion);
-        // retrieve inital size, since size of the list is not stable
+        // retrieve initial size, since size of the list is not stable
         size = versions.size();
     }
 
@@ -134,19 +134,25 @@
     }
 
     /**
-     * Adds the version 'v' to the list of versions to return and then calls
-     * it self recursively with all the verions prodecessors.
+     * Adds the version 'v' to the list of versions to return and then iterates
+     * over the hierarchy of successors of 'v'.
      *
      * @param v
      */
     private synchronized void addVersion(InternalVersion v) {
-        NodeId id = v.getId();
-        if (!versions.contains(id)) {
-            versions.add(id);
-            InternalVersion[] vs = v.getSuccessors();
-            for (int i = 0; i < vs.length; i++) {
-                addVersion(vs[i]);
+        LinkedList workQueue = new LinkedList();
+        workQueue.add(v);
+        while (!workQueue.isEmpty()) {
+            InternalVersion currentVersion = (InternalVersion) workQueue.removeFirst();
+            NodeId id = currentVersion.getId();
+            if (!versions.contains(id)) {
+                versions.add(id);
+                InternalVersion[] successors = currentVersion.getSuccessors();
+                for (int i = 0; i < successors.length; i++) {
+                    workQueue.add(successors[i]);
+                }
             }
         }
+
     }
 }



Mime
View raw message