directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 47551 - in incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db: . jdbm
Date Thu, 30 Sep 2004 04:15:32 GMT
Author: akarasulu
Date: Wed Sep 29 21:15:31 2004
New Revision: 47551

Removed:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/jdbm/DisjunctionEnumeratorImpl.java
Modified:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/DisjunctionEnumerator.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/jdbm/EnumeratorImpl.java
Log:
Commit changes ...

 o removed the DisjunctionEnumerator interface
 o made DisjunctionEnumeratorImpl implement Enumerator instead of 
   DisjunctionEnumerator 
 o moved DisjunctionEnumeratorImpl up to db pkg and renamed to 
   DisjunctionEnumerator 



Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/DisjunctionEnumerator.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/DisjunctionEnumerator.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/DisjunctionEnumerator.java
Wed Sep 29 21:15:31 2004
@@ -17,13 +17,56 @@
 package org.apache.eve.db;
 
 
+import java.util.ArrayList;
+
+import javax.naming.NamingException;
+import javax.naming.NamingEnumeration;
+
+import org.apache.ldap.common.filter.ExprNode;
+import org.apache.ldap.common.filter.BranchNode;
+
+
 /**
- * Creates Enumerations over a set of entry candidates based on a disjunction
- * (and'ed set) of assertion expressions.
+ * Creates a naming enumeration over the set of candidates accepted by a set
+ * of filter expressions joined together using the OR ('|') operator. 
  * 
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public interface DisjunctionEnumerator extends Enumerator
+public class DisjunctionEnumerator implements Enumerator
 {
+    /** Top level expression enumerator - non Avalon dependency avaoids cycle */
+    private Enumerator enumerator;
+
+
+    /**
+     * Creates a disjunction enumerator using a top level enumerator.
+     *
+     * @param enumerator the top level enumerator
+     */
+    public DisjunctionEnumerator( Enumerator enumerator )
+    {
+        this.enumerator = enumerator;
+    }
+
+
+    /**
+     * @see Enumerator#enumerate(ExprNode)
+     */
+    public NamingEnumeration enumerate( ExprNode node )
+        throws NamingException
+    {
+        ArrayList children = ( ( BranchNode ) node ).getChildren();
+        NamingEnumeration [] childEnumerations = 
+            new NamingEnumeration [children.size()];
+
+        // Recursively create NamingEnumerations for each child expression node
+        for ( int ii = 0; ii < childEnumerations.length; ii++ ) 
+        {
+            childEnumerations[ii] =
+                enumerator.enumerate( ( ExprNode ) children.get( ii ) );
+        }
+
+        return new DisjunctionEnumeration( childEnumerations );
+    }
 }

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/jdbm/EnumeratorImpl.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/jdbm/EnumeratorImpl.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/jdbm/EnumeratorImpl.java
Wed Sep 29 21:15:31 2004
@@ -46,7 +46,7 @@
         scopeEnumerator = new ScopeEnumeratorImpl();
         substringEnumerator = new SubstringEnumeratorImpl();
         conjunctionEnumerator = new ConjunctionEnumerator( this, topEvaluator );
-        disjunctionEnumerator = new DisjunctionEnumeratorImpl( this );
+        disjunctionEnumerator = new DisjunctionEnumerator( this );
         negationEnumerator = new NegationEnumeratorImpl();
     }
 

Mime
View raw message