directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1161279 [2/4] - in /directory/apacheds/branches/one-sub-level-index-removal: ./ all/ core-annotations/ core-api/ core-api/src/main/java/org/apache/directory/server/core/filtering/ core-avl/ core-avl/src/test/java/org/apache/directory/serve...
Date Wed, 24 Aug 2011 21:19:37 GMT
Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java Wed Aug 24 21:19:34 2011
@@ -23,9 +23,8 @@ package org.apache.directory.server.xdbm
 import java.util.Iterator;
 
 import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.model.cursor.ClosureMonitor;
+import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
 import org.apache.directory.shared.ldap.model.cursor.CursorIterator;
-import org.apache.directory.shared.ldap.model.cursor.DefaultClosureMonitor;
 
 
 /**
@@ -33,67 +32,82 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public abstract class AbstractIndexCursor<K, E, ID> implements IndexCursor<K, E, ID>
+public abstract class AbstractIndexCursor<V, Entry, ID> extends AbstractCursor<IndexEntry<V, ID>> implements IndexCursor<V, Entry, ID>
 {
-    private ClosureMonitor monitor = new DefaultClosureMonitor();
+    /** Tells if there are some element available in the cursor */
+    private boolean available = false;
 
+    /** The message used for unsupported operations */
+    protected static final String UNSUPPORTED_MSG = "Unsupported operation";
 
     /**
      * {@inheritDoc}
      */
-    public final void setClosureMonitor( ClosureMonitor monitor )
+    public boolean available()
     {
-        if ( monitor == null )
-        {
-            throw new IllegalArgumentException( "monitor" );
-        }
-
-        this.monitor = monitor;
+        return available;
     }
+    
+    
+    /**
+     * Gets the message to return for operations that are not supported
+     * 
+     * @return The Unsupported message
+     */
+    protected abstract String getUnsupportedMessage();
 
 
     /**
      * {@inheritDoc}
      */
-    protected final void checkNotClosed( String operation ) throws Exception
+    public void after( IndexEntry<V, ID> element ) throws Exception
     {
-        monitor.checkNotClosed();
+        throw new UnsupportedOperationException( getUnsupportedMessage() );
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public final boolean isClosed()
+    public void before( IndexEntry<V, ID> element ) throws Exception
+    {
+        throw new UnsupportedOperationException( getUnsupportedMessage() );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void afterValue( ID id, V value ) throws Exception
     {
-        return monitor.isClosed();
+        throw new UnsupportedOperationException( getUnsupportedMessage() );
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public void close() throws Exception
+    public void beforeValue( ID id, V value ) throws Exception
     {
-        monitor.close();
+        throw new UnsupportedOperationException( getUnsupportedMessage() );
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public void close( Exception cause ) throws Exception
+    protected boolean setAvailable( boolean available )
     {
-        monitor.close( cause );
+        return this.available = available;
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public Iterator<IndexEntry<K, E, ID>> iterator()
+    public Iterator<IndexEntry<V, ID>> iterator()
     {
-        return new CursorIterator<IndexEntry<K, E, ID>>( this );
+        return new CursorIterator<IndexEntry<V, ID>>( this );
     }
 
 

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexEntry.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexEntry.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexEntry.java Wed Aug 24 21:19:34 2011
@@ -20,6 +20,7 @@
 package org.apache.directory.server.xdbm;
 
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 
 
 /**
@@ -28,21 +29,20 @@ import org.apache.directory.shared.ldap.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @param <V> The value stored in the Tuple, associated key for the object
  * @param <ID> The ID of the object
- * @param <O> The associated object
  */
-public abstract class AbstractIndexEntry<V, O, ID> implements IndexEntry<V, O, ID>
+public abstract class AbstractIndexEntry<V, ID> implements IndexEntry<V, ID>
 {
-    /** The referenced object if loaded from the store */
-    private O object;
+    /** The referenced Entry if loaded from the store */
+    private Entry entry;
 
     /**
      * Creates an instance of AbstractIndexEntry
      * 
-     * @param object The interned object
+     * @param object The interned Entry
      */
-    protected AbstractIndexEntry( O object )
+    protected AbstractIndexEntry( Entry entry )
     {
-        this.object = object;
+        this.entry = entry;
     }
     
     
@@ -73,9 +73,9 @@ public abstract class AbstractIndexEntry
     /**
      * {@inheritDoc}
      */
-    public O getObject()
+    public Entry getEntry()
     {
-        return object;
+        return entry;
     }
 
     
@@ -88,9 +88,9 @@ public abstract class AbstractIndexEntry
     /**
      * {@inheritDoc}
      */
-    public void setObject( O object )
+    public void setEntry( Entry entry )
     {
-        this.object = object;
+        this.entry = entry;
     }
 
     
@@ -99,15 +99,15 @@ public abstract class AbstractIndexEntry
      */
     public void clear()
     {
-        object = null;
+        entry = null;
     }
 
     
     /**
      * {@inheritDoc}
      */
-    public void copy( IndexEntry<V, O, ID> entry )
+    public void copy( IndexEntry<V, ID> entry )
     {
-        object = entry.getObject();
+        this.entry = entry.getEntry();
     }
 }

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/EmptyIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/EmptyIndexCursor.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/EmptyIndexCursor.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/EmptyIndexCursor.java Wed Aug 24 21:19:34 2011
@@ -30,19 +30,28 @@ import org.apache.directory.shared.ldap.
  */
 public class EmptyIndexCursor<K, E, ID> extends AbstractIndexCursor<K, E, ID>
 {
-    public boolean available()
+    /**
+     * {@inheritDoc}
+     */
+    public void before( IndexEntry<K, ID> element ) throws Exception
     {
-        return false;
+        checkNotClosed( "before()" );
     }
 
 
-    public void before( IndexEntry<K, E, ID> element ) throws Exception
-    {
-        checkNotClosed( "before()" );
+    /**
+     * {@inheritDoc}
+     */
+    protected String getUnsupportedMessage()
+    {
+        return UNSUPPORTED_MSG;
     }
 
-
-    public void after( IndexEntry<K, E, ID> element ) throws Exception
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void after( IndexEntry<K, ID> element ) throws Exception
     {
         checkNotClosed( "after()" );
     }
@@ -88,19 +97,25 @@ public class EmptyIndexCursor<K, E, ID> 
     }
 
 
-    public IndexEntry<K, E, ID> get() throws Exception
+    public IndexEntry<K, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
         throw new InvalidCursorPositionException( I18n.err( I18n.ERR_703 ) );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void afterValue( ID id, K indexValue ) throws Exception
     {
         checkNotClosed( "after()" );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void beforeValue( ID id, K indexValue ) throws Exception
     {
         checkNotClosed( "after()" );

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ForwardIndexEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ForwardIndexEntry.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ForwardIndexEntry.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ForwardIndexEntry.java Wed Aug 24 21:19:34 2011
@@ -20,18 +20,18 @@
 package org.apache.directory.server.xdbm;
 
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 
 
 /**
  * An index id value pair based on a Tuple which can optionally reference the
- * indexed object if one has already been loaded.
+ * indexed Entry if one has already been loaded.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @param <V> The value stored in the Tuple, associated key for the object
  * @param <ID> The ID of the object
- * @param <O> The associated object
  */
-public class ForwardIndexEntry<V, O, ID> extends AbstractIndexEntry<V, O, ID>
+public class ForwardIndexEntry<V, ID> extends AbstractIndexEntry<V, ID>
 {
     /** The underlying Tuple */
     private final Tuple<V, ID> tuple = new Tuple<V, ID>();
@@ -48,15 +48,15 @@ public class ForwardIndexEntry<V, O, ID>
     
     /**
      * Sets the key value tuple represented by this ForwardIndexEntry optionally
-     * setting the obj associated with the id if one was loaded from the
+     * setting the Entry associated with the id if one was loaded from the
      * master table.
      *
      * @param tuple the tuple for the ForwardIndexEntry
-     * @param object the resuscitated object if any
+     * @param entry the resuscitated Entry if any
      */
-    public void setTuple( Tuple<V, ID> tuple, O object )
+    public void setTuple( Tuple<V, ID> tuple, Entry entry )
     {
-        setObject( object );
+        setEntry( entry );
         this.tuple.setKey( tuple.getKey() );
         this.tuple.setValue( tuple.getValue() );
     }
@@ -121,7 +121,7 @@ public class ForwardIndexEntry<V, O, ID>
     /**
      * {@inheritDoc}
      */
-    public void copy( IndexEntry<V, O, ID> entry )
+    public void copy( IndexEntry<V, ID> entry )
     {
         super.copy( entry );
         tuple.setKey( entry.getValue() );

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/IndexCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/IndexCursor.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/IndexCursor.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/IndexCursor.java Wed Aug 24 21:19:34 2011
@@ -29,7 +29,7 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public interface IndexCursor<V, E, ID> extends Cursor<IndexEntry<V, E, ID>>
+public interface IndexCursor<V, E, ID> extends Cursor<IndexEntry<V, ID>>
 {
     /**
      * An alternative to calling before(IndexEntry) which often may require

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/IndexEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/IndexEntry.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/IndexEntry.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/IndexEntry.java Wed Aug 24 21:19:34 2011
@@ -20,24 +20,24 @@
 package org.apache.directory.server.xdbm;
 
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 
 
 /**
- * Interface for index entries. An index entry associate an Entry object with 
- * a value (the key) and the Object ID in the table where it's stored. The Object
- * may be present in this instance once we read it from the tabe.
+ * Interface for index entries. An index entry associate an Entry with 
+ * a value (the key) and the Entry ID in the table where it's stored. The Entry
+ * may be present in this instance once we read it from the table.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @param <V> The value stored in the Tuple, associated key for the object
  * @param <ID> The ID of the object
- * @param <O> The associated object
  */
-public interface IndexEntry<V, O, ID>
+public interface IndexEntry<V, ID>
 {
     /**
      * Gets the value referred to by this IndexEntry.
      *
-     * @return the value of the object referred to
+     * @return the value of the Entry referred to
      */
     V getValue();
 
@@ -45,33 +45,33 @@ public interface IndexEntry<V, O, ID>
     /**
      * Sets the value referred to by this IndexEntry.
      *
-     * @param value the value of the object referred to
+     * @param value the value of the Entry referred to
      */
     void setValue( V value );
 
 
     /**
-     * Gets the id of the indexed object.
+     * Gets the id of the indexed Entry.
      *
-     * @return the id of the indexed object
+     * @return the id of the indexed Entry
      */
     ID getId();
 
 
     /**
-     * Sets the id of the indexed.object
+     * Sets the id of the indexed.Entry
      *
-     * @param id the id of the indexed object
+     * @param id the id of the indexed Entry
      */
     void setId( ID id );
 
 
     /**
-     * Gets the object indexed if resuscitated.
+     * Gets the Entry indexed if found.
      *
-     * @return the object indexed
+     * @return the indexed Entry
      */
-    O getObject();
+    Entry getEntry();
 
 
     /**
@@ -83,15 +83,15 @@ public interface IndexEntry<V, O, ID>
 
 
     /**
-     * Sets the indexed object.
+     * Sets the indexed Entry.
      *
-     * @param obj the indexed object
+     * @param entry the indexed Entry
      */
-    void setObject( O obj );
+    void setEntry( Entry entry );
 
 
     /**
-     * Clears the id, value and object in this IndexEntry.
+     * Clears the id, value and Entry in this IndexEntry.
      */
     void clear();
 
@@ -101,5 +101,5 @@ public interface IndexEntry<V, O, ID>
      *
      * @param entry the entry to copy fields of
      */
-    void copy( IndexEntry<V, O, ID> entry );
+    void copy( IndexEntry<V, ID> entry );
 }

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ReverseIndexEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ReverseIndexEntry.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ReverseIndexEntry.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ReverseIndexEntry.java Wed Aug 24 21:19:34 2011
@@ -20,18 +20,18 @@
 package org.apache.directory.server.xdbm;
 
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 
 
 /**
- * An index id value pair which can optionally reference the indexed obj
+ * An index id value pair which can optionally reference the indexed Entry
  * if one has already been loaded.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @param <V> The value stored in the Tuple, associated key for the object
- * @param <ID> The ID of the object
- * @param <O> The associated object
+ * @param <V> The value stored in the Tuple, associated key for the Entry
+ * @param <ID> The ID of the Entry
  */
-public class ReverseIndexEntry<V, O, ID> extends AbstractIndexEntry<V, O, ID>
+public class ReverseIndexEntry<V, ID> extends AbstractIndexEntry<V, ID>
 {
     /** The underlying Tuple */
     private final Tuple<ID, V> tuple = new Tuple<ID, V>();
@@ -49,15 +49,15 @@ public class ReverseIndexEntry<V, O, ID>
 
     /**
      * Sets the Tuple value represented by this ReverseIndexEntry optionally
-     * setting the obj associated with the id if one was loaded from the
+     * setting the Entry associated with the id if one was loaded from the
      * master table.
      *
      * @param tuple the tuple for the ReverseIndexEntry
-     * @param obj the resusitated object that is indexed if any
+     * @param obj the resusitated Entry that is indexed if any
      */
-    public void setTuple( Tuple<ID, V> tuple, O object )
+    public void setTuple( Tuple<ID, V> tuple, Entry entry )
     {
-        setObject( object );
+        setEntry( entry );
         this.tuple.setKey( tuple.getKey() );
         this.tuple.setValue( tuple.getValue() );
     }
@@ -102,7 +102,7 @@ public class ReverseIndexEntry<V, O, ID>
     /**
      * {@inheritDoc}
      */
-    public Tuple<ID, V> getTuple()
+    public Tuple<?, ?> getTuple()
     {
         return tuple;
     }
@@ -122,9 +122,9 @@ public class ReverseIndexEntry<V, O, ID>
     /**
      * {@inheritDoc}
      */
-    public void copy( IndexEntry<V, O, ID> entry )
+    public void copy( IndexEntry<V, ID> entry )
     {
-        setObject( entry.getObject() );
+        setEntry( entry.getEntry() );
         tuple.setKey( entry.getId() );
         tuple.setValue( entry.getValue() );
     }

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/SingletonIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/SingletonIndexCursor.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/SingletonIndexCursor.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/SingletonIndexCursor.java Wed Aug 24 21:19:34 2011
@@ -21,6 +21,7 @@ package org.apache.directory.server.xdbm
 
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 
 
 /**
@@ -28,47 +29,32 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SingletonIndexCursor<K, E, ID> extends AbstractIndexCursor<K, E, ID>
+public class SingletonIndexCursor<V, ID> extends AbstractIndexCursor<V, Entry, ID>
 {
     private boolean beforeFirst = true;
     private boolean afterLast;
     private boolean onSingleton;
-    private final IndexEntry<K, E, ID> singleton;
+    private final IndexEntry<V, ID> singleton;
 
 
-    public SingletonIndexCursor( IndexEntry<K, E, ID> singleton )
+    public SingletonIndexCursor( IndexEntry<V, ID> singleton )
     {
         this.singleton = singleton;
     }
 
 
-    public boolean available()
+    /**
+     * {@inheritDoc}
+     */
+    protected String getUnsupportedMessage()
     {
-        return onSingleton;
+        return UNSUPPORTED_MSG;
     }
 
-
-    public void before( IndexEntry<K, E, ID> element ) throws Exception
-    {
-        throw new UnsupportedOperationException();
-    }
-
-
-    public void beforeValue( ID id, K value ) throws Exception
-    {
-        throw new UnsupportedOperationException();
-    }
-
-
-    public void afterValue( ID id, K value ) throws Exception
-    {
-        throw new UnsupportedOperationException();
-    }
-
-
-    public void after( IndexEntry<K, E, ID> element ) throws Exception
+    
+    public boolean available()
     {
-        throw new UnsupportedOperationException();
+        return onSingleton;
     }
 
 
@@ -186,9 +172,10 @@ public class SingletonIndexCursor<K, E, 
     }
 
 
-    public IndexEntry<K, E, ID> get() throws Exception
+    public IndexEntry<V, ID> get() throws Exception
     {
         checkNotClosed( "()" );
+        
         if ( onSingleton )
         {
             return singleton;

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/Evaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/Evaluator.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/Evaluator.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/Evaluator.java Wed Aug 24 21:19:34 2011
@@ -62,7 +62,7 @@ public interface Evaluator<N extends Exp
      * @return true if filter selects the candidate false otherwise
      * @throws Exception if there are faults during evaluation
      */
-    boolean evaluate( IndexEntry<?, E, ID> entry ) throws Exception;
+    boolean evaluate( IndexEntry<?, ID> entry ) throws Exception;
 
 
     /**

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java Wed Aug 24 21:19:34 2011
@@ -35,10 +35,27 @@ import org.apache.directory.shared.ldap.
  */
 public class AllEntriesCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<ID, Entry, ID>
 {
-    private IndexEntry<ID, Entry, ID> indexEntry = new ForwardIndexEntry<ID, Entry, ID>();
+    /** The index entry we use to return entries one by one.  */
+    private IndexEntry<ID, ID> indexEntry = new ForwardIndexEntry<ID, ID>();
+    
+    /** The cursor on the EntryUUID index */
     private final IndexCursor<String, Entry, ID> wrapped;
 
 
+    /**
+     * {@inheritDoc}
+     */
+    protected String getUnsupportedMessage()
+    {
+        return UNSUPPORTED_MSG;
+    }
+
+    
+    /**
+     * Creates a new instance of AllEntriesCursor
+     * @param db
+     * @throws Exception
+     */
     public AllEntriesCursor( Store<Entry, ID> db ) throws Exception
     {
         // Get a reverse cursor because we want to sort by ID
@@ -46,48 +63,52 @@ public class AllEntriesCursor<ID extends
     }
 
 
-    /* 
-     * @see org.apache.directory.server.xdbm.IndexCursor#afterValue(Long, Object)
+    /**
+     * {@inheritDoc}
      */
     public void afterValue( ID key, ID value ) throws Exception
     {
         checkNotClosed( "afterValue()" );
+        
         wrapped.afterValue( key, null );
     }
 
 
-    /* 
-     * @see org.apache.directory.server.xdbm.IndexCursor#beforeValue(java.lang.Long, java.lang.Object)
+    /**
+     * {@inheritDoc}
      */
     public void beforeValue( ID id, ID value ) throws Exception
     {
         checkNotClosed( "beforeValue()" );
+        
         wrapped.beforeValue( id, null );
     }
 
 
-    /* 
-     * @see org.apache.directory.server.core.cursor.Cursor#after(java.lang.Object)
+    /**
+     * {@inheritDoc}
      */
-    public void after( IndexEntry<ID, Entry, ID> indexEntry ) throws Exception
+    public void after( IndexEntry<ID, ID> indexEntry ) throws Exception
     {
         checkNotClosed( "after()" );
+        
         wrapped.afterValue( indexEntry.getId(), null );
     }
 
 
-    /* 
-     * @see org.apache.directory.server.core.cursor.Cursor#afterLast()
+    /**
+     * {@inheritDoc}
      */
     public void afterLast() throws Exception
     {
         checkNotClosed( "afterLast()" );
+        
         wrapped.afterLast();
     }
 
 
-    /* 
-     * @see org.apache.directory.server.core.cursor.Cursor#available()
+    /**
+     * {@inheritDoc}
      */
     public boolean available()
     {
@@ -95,92 +116,105 @@ public class AllEntriesCursor<ID extends
     }
 
 
-    /* 
-     * @see org.apache.directory.server.core.cursor.Cursor#before(java.lang.Object)
+    /**
+     * {@inheritDoc}
      */
-    public void before( IndexEntry<ID, Entry, ID> indexEntry ) throws Exception
+    public void before( IndexEntry<ID, ID> indexEntry ) throws Exception
     {
         checkNotClosed( "before()" );
+        
         wrapped.beforeValue( indexEntry.getId(), null );
     }
 
 
-    /* 
-     * @see org.apache.directory.server.core.cursor.Cursor#beforeFirst()
+    /**
+     * {@inheritDoc}
      */
     public void beforeFirst() throws Exception
     {
         checkNotClosed( "beforeFirst()" );
+        
         wrapped.beforeFirst();
     }
 
 
-    /* 
-     * @see org.apache.directory.server.core.cursor.Cursor#first()
+    /**
+     * {@inheritDoc}
      */
     public boolean first() throws Exception
     {
         checkNotClosed( "first()" );
+        
         return wrapped.first();
     }
 
 
-    /* 
-     * @see org.apache.directory.server.core.cursor.Cursor#get()
+    /**
+     * {@inheritDoc}
      */
-    public IndexEntry<ID, Entry, ID> get() throws Exception
+    public IndexEntry<ID, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
-        IndexEntry<String, Entry, ID> wrappedEntry = wrapped.get();
+        
+        // Create the returned IndexEntry, copying what we get from the wrapped cursor
+        IndexEntry<String, ID> wrappedEntry = wrapped.get();
         indexEntry.setId( wrappedEntry.getId() );
         indexEntry.setValue( wrappedEntry.getId() );
-        indexEntry.setObject( wrappedEntry.getObject() );
+        indexEntry.setEntry( wrappedEntry.getEntry() );
+        
         return indexEntry;
     }
 
 
-    /* 
-     * @see org.apache.directory.server.core.cursor.Cursor#last()
+    /**
+     * {@inheritDoc}
      */
     public boolean last() throws Exception
     {
         checkNotClosed( "last()" );
+        
         return wrapped.last();
     }
 
 
-    /* 
-     * @see org.apache.directory.server.core.cursor.Cursor#next()
+    /**
+     * {@inheritDoc}
      */
     public boolean next() throws Exception
     {
         checkNotClosed( "next()" );
+        
         return wrapped.next();
     }
 
 
-    /* 
-     * @see org.apache.directory.server.core.cursor.Cursor#previous()
+    /**
+     * {@inheritDoc}
      */
     public boolean previous() throws Exception
     {
         checkNotClosed( "previous()" );
+        
         return wrapped.previous();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public void close() throws Exception
     {
         wrapped.close();
-        super.close();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public void close( Exception cause ) throws Exception
     {
-        wrapped.close();
-        super.close( cause );
+        wrapped.close( cause );
     }
 }

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java Wed Aug 24 21:19:34 2011
@@ -22,7 +22,6 @@ package org.apache.directory.server.xdbm
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.List;
 
 import org.apache.directory.server.i18n.I18n;
@@ -42,12 +41,23 @@ import org.apache.directory.shared.ldap.
  */
 public class AndCursor<V, ID> extends AbstractIndexCursor<V, Entry, ID>
 {
+    /** The message for unsupported operations */
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_707 );
+    
+    /** */
     private final IndexCursor<V, Entry, ID> wrapped;
+    
+    /** The evaluators used for the members of the And filter */
     private final List<Evaluator<? extends ExprNode, Entry, ID>> evaluators;
-    private boolean available = false;
 
 
+    /**
+     * Creates an instance of a AndCursor. It wraps an index cursor and the list
+     * of evaluators associated with all the elements connected by the And.
+     * 
+     * @param wrapped The encapsulated IndexCursor
+     * @param evaluators The list of evaluators associated wth the elements
+     */
     public AndCursor( IndexCursor<V, Entry, ID> wrapped,
         List<Evaluator<? extends ExprNode, Entry, ID>> evaluators )
     {
@@ -56,104 +66,108 @@ public class AndCursor<V, ID> extends Ab
     }
 
 
-    public boolean available()
-    {
-        return available;
-    }
-
-
-    public void beforeValue( ID id, V value )
-    {
-        throw new UnsupportedOperationException( UNSUPPORTED_MSG );
-    }
-
-
-    public void afterValue( ID id, V value )
-    {
-        throw new UnsupportedOperationException( UNSUPPORTED_MSG );
-    }
-
-
-    public void before( IndexEntry<V, Entry, ID> element ) throws Exception
-    {
-        throw new UnsupportedOperationException( UNSUPPORTED_MSG );
-    }
-
-
-    public void after( IndexEntry<V, Entry, ID> element ) throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    protected String getUnsupportedMessage()
     {
-        throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+        return UNSUPPORTED_MSG;
     }
 
-
+    
+    /**
+     * {@inheritDoc}
+     */
     public void beforeFirst() throws Exception
     {
         checkNotClosed( "beforeFirst()" );
         wrapped.beforeFirst();
-        available = false;
+        setAvailable( false );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void afterLast() throws Exception
     {
         checkNotClosed( "afterLast()" );
         wrapped.afterLast();
-        available = false;
+        setAvailable( false );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean first() throws Exception
     {
         beforeFirst();
+        
         return next();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean last() throws Exception
     {
         afterLast();
+        
         return previous();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean previous() throws Exception
     {
         while ( wrapped.previous() )
         {
             checkNotClosed( "previous()" );
 
-            IndexEntry<?, Entry, ID> candidate = wrapped.get();
+            IndexEntry<V, ID> candidate = wrapped.get();
+            
             if ( matches( candidate ) )
             {
-                return available = true;
+                return setAvailable( true );
             }
         }
 
-        return available = false;
+        return setAvailable( false );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean next() throws Exception
     {
         while ( wrapped.next() )
         {
             checkNotClosed( "next()" );
-            IndexEntry<?, Entry, ID> candidate = wrapped.get();
+            IndexEntry<V, ID> candidate = wrapped.get();
             
             if ( matches( candidate ) )
             {
-                return available = true;
+                return setAvailable( true );
             }
         }
 
-        return available = false;
+        return setAvailable( false);
     }
 
 
-    public IndexEntry<V, Entry, ID> get() throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public IndexEntry<V, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
-        if ( available )
+        
+        if ( available() )
         {
             return wrapped.get();
         }
@@ -162,6 +176,9 @@ public class AndCursor<V, ID> extends Ab
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void close() throws Exception
     {
         super.close();
@@ -170,9 +187,6 @@ public class AndCursor<V, ID> extends Ab
 
 
     /**
-     * TODO - duplicate code from AndEvaluator just make utility for this and
-     * for the same code in the OrEvaluator once done.
-     *
      * Takes a set of Evaluators and copies then sorts them in a new list with
      * increasing scan counts on their expression nodes.  This is done to have
      * the Evaluators with the least scan count which have the highest
@@ -190,38 +204,16 @@ public class AndCursor<V, ID> extends Ab
             unoptimized.size() );
         optimized.addAll( unoptimized );
 
-        Collections.sort( optimized, new Comparator<Evaluator<?, Entry, ID>>()
-        {
-            public int compare( Evaluator<?, Entry, ID> e1, Evaluator<?, Entry, ID> e2 )
-            {
-                long scanCount1 = ( Long ) e1.getExpression().get( "count" );
-                long scanCount2 = ( Long ) e2.getExpression().get( "count" );
-
-                if ( scanCount1 == scanCount2 )
-                {
-                    return 0;
-                }
-
-                /*
-                 * We want the Evaluator with the smallest scan count first
-                 * since this node has the highest probability of failing, or
-                 * rather the least probability of succeeding.  That way we
-                 * can short the sub-expression evaluation process.
-                 */
-                if ( scanCount1 < scanCount2 )
-                {
-                    return -1;
-                }
-
-                return 1;
-            }
-        } );
+        Collections.sort( optimized, new ScanCountComparator<ID>() );
 
         return optimized;
     }
 
 
-    private boolean matches( IndexEntry<?, Entry, ID> indexEntry ) throws Exception
+    /**
+     * Checks if the entry is a valid candidate by using the evaluators.
+     */
+    private boolean matches( IndexEntry<V, ID> indexEntry ) throws Exception
     {
         for ( Evaluator<?, Entry, ID> evaluator : evaluators )
         {

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndEvaluator.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndEvaluator.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndEvaluator.java Wed Aug 24 21:19:34 2011
@@ -22,7 +22,6 @@ package org.apache.directory.server.xdbm
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.List;
 
 import org.apache.directory.server.xdbm.IndexEntry;
@@ -46,6 +45,11 @@ public class AndEvaluator<ID> implements
     private final AndNode node;
 
 
+    /**
+     * Creates an instance of AndEvaluator
+     * @param node The And Node
+     * @param evaluators The list of evaluators for all the contaned nodes
+     */
     public AndEvaluator( AndNode node, List<Evaluator<? extends ExprNode, Entry, ID>> evaluators )
     {
         this.node = node;
@@ -64,44 +68,22 @@ public class AndEvaluator<ID> implements
      * @param unoptimized the unoptimized list of Evaluators
      * @return optimized Evaluator list with increasing scan count ordering
      */
-    private List<Evaluator<? extends ExprNode, Entry, ID>> optimize(
+    List<Evaluator<? extends ExprNode, Entry, ID>> optimize(
         List<Evaluator<? extends ExprNode, Entry, ID>> unoptimized )
     {
         List<Evaluator<? extends ExprNode, Entry, ID>> optimized = new ArrayList<Evaluator<? extends ExprNode, Entry, ID>>(
             unoptimized.size() );
         optimized.addAll( unoptimized );
         
-        Collections.sort( optimized, new Comparator<Evaluator<?, Entry, ID>>()
-        {
-            public int compare( Evaluator<?, Entry, ID> e1, Evaluator<?, Entry, ID> e2 )
-            {
-                long scanCount1 = ( Long ) e1.getExpression().get( "count" );
-                long scanCount2 = ( Long ) e2.getExpression().get( "count" );
-
-                if ( scanCount1 == scanCount2 )
-                {
-                    return 0;
-                }
-
-                /*
-                 * We want the Evaluator with the smallest scan count first
-                 * since this node has the highest probability of failing, or
-                 * rather the least probability of succeeding.  That way we
-                 * can short the sub-expression evaluation process.
-                 */
-                if ( scanCount1 < scanCount2 )
-                {
-                    return -1;
-                }
-
-                return 1;
-            }
-        } );
+        Collections.sort( optimized, new ScanCountComparator<ID>() );
 
         return optimized;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean evaluateEntry( Entry entry ) throws Exception
     {
         for ( Evaluator<?, Entry, ID> evaluator : evaluators )
@@ -116,7 +98,10 @@ public class AndEvaluator<ID> implements
     }
 
 
-    public boolean evaluate( IndexEntry<?, Entry, ID> indexEntry ) throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
     {
         for ( Evaluator<?, Entry, ID> evaluator : evaluators )
         {
@@ -130,6 +115,9 @@ public class AndEvaluator<ID> implements
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public AndNode getExpression()
     {
         return node;

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java Wed Aug 24 21:19:34 2011
@@ -45,6 +45,7 @@ import org.apache.directory.shared.ldap.
  */
 public class ApproximateCursor<V, ID extends Comparable<ID>> extends AbstractIndexCursor<V, Entry, ID>
 {
+    /** The message for unsupported operations */
     private static final String UNSUPPORTED_MSG = "ApproximateCursors only support positioning by element when a user index exists on the asserted attribute.";
 
     /** An approximate evaluator for candidates */
@@ -56,10 +57,12 @@ public class ApproximateCursor<V, ID ext
     /** NDN Cursor on all entries in  (set when no index on user attribute) */
     private final IndexCursor<String, Entry, ID> uuidIdxCursor;
 
-    /** used only when ndnIdxCursor is used (no index on attribute) */
-    private boolean available = false;
-
-
+    /**
+     * Creates a new instance of ApproximateCursor
+     * @param db The Store we want to build a cursor on
+     * @param approximateEvaluator The evaluator
+     * @throws Exception If the creation failed
+     */
     @SuppressWarnings("unchecked")
     public ApproximateCursor( Store<Entry, ID> db, ApproximateEvaluator<V, ID> approximateEvaluator ) throws Exception
     {
@@ -82,6 +85,18 @@ public class ApproximateCursor<V, ID ext
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
+    protected String getUnsupportedMessage()
+    {
+        return UNSUPPORTED_MSG;
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
     public boolean available()
     {
         if ( userIdxCursor != null )
@@ -89,10 +104,13 @@ public class ApproximateCursor<V, ID ext
             return userIdxCursor.available();
         }
 
-        return available;
+        return super.available();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void beforeValue( ID id, V value ) throws Exception
     {
         checkNotClosed( "beforeValue()" );
@@ -103,53 +121,69 @@ public class ApproximateCursor<V, ID ext
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.beforeValue( id, value );
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void afterValue( ID id, V value ) throws Exception
     {
         checkNotClosed( "afterValue()" );
+        
         if ( userIdxCursor != null )
         {
             userIdxCursor.afterValue( id, value );
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.afterValue( id, value );
         }
     }
 
 
-    public void before( IndexEntry<V, Entry, ID> element ) throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public void before( IndexEntry<V, ID> element ) throws Exception
     {
         checkNotClosed( "before()" );
+        
         if ( userIdxCursor != null )
         {
             userIdxCursor.before( element );
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.before( element );
         }
     }
 
 
-    public void after( IndexEntry<V, Entry, ID> element ) throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void after( IndexEntry<V, ID> element ) throws Exception
     {
         checkNotClosed( "after()" );
+        
         if ( userIdxCursor != null )
         {
             userIdxCursor.after( element );
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.after( element );
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void beforeFirst() throws Exception
     {
         checkNotClosed( "beforeFirst()" );
@@ -160,14 +194,18 @@ public class ApproximateCursor<V, ID ext
         else
         {
             uuidIdxCursor.beforeFirst();
-            available = false;
+            setAvailable( false );
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void afterLast() throws Exception
     {
         checkNotClosed( "afterLast()" );
+        
         if ( userIdxCursor != null )
         {
             userIdxCursor.afterLast();
@@ -175,25 +213,36 @@ public class ApproximateCursor<V, ID ext
         else
         {
             uuidIdxCursor.afterLast();
-            available = false;
+            setAvailable( false );
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean first() throws Exception
     {
         beforeFirst();
+        
         return next();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean last() throws Exception
     {
         afterLast();
+        
         return previous();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean previous() throws Exception
     {
         if ( userIdxCursor != null )
@@ -204,17 +253,21 @@ public class ApproximateCursor<V, ID ext
         while ( uuidIdxCursor.previous() )
         {
             checkNotClosed( "previous()" );
-            IndexEntry<?, Entry, ID> candidate = uuidIdxCursor.get();
+            IndexEntry<?, ID> candidate = uuidIdxCursor.get();
+            
             if ( approximateEvaluator.evaluate( candidate ) )
             {
-                return available = true;
+                return setAvailable( true );
             }
         }
 
-        return available = false;
+        return setAvailable( false );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean next() throws Exception
     {
         if ( userIdxCursor != null )
@@ -225,35 +278,42 @@ public class ApproximateCursor<V, ID ext
         while ( uuidIdxCursor.next() )
         {
             checkNotClosed( "next()" );
-            IndexEntry<?, Entry, ID> candidate = uuidIdxCursor.get();
+            IndexEntry<?, ID> candidate = uuidIdxCursor.get();
+            
             if ( approximateEvaluator.evaluate( candidate ) )
             {
-                return available = true;
+                return setAvailable( true );
             }
         }
 
-        return available = false;
+        return setAvailable( false );
     }
 
-
+    /**
+     * {@inheritDoc}
+     */
     @SuppressWarnings("unchecked")
-    public IndexEntry<V, Entry, ID> get() throws Exception
+    public IndexEntry<V, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
+        
         if ( userIdxCursor != null )
         {
             return userIdxCursor.get();
         }
 
-        if ( available )
+        if ( available() )
         {
-            return ( IndexEntry<V, Entry, ID> ) uuidIdxCursor.get();
+            return ( IndexEntry<V, ID> ) uuidIdxCursor.get();
         }
 
         throw new InvalidCursorPositionException( I18n.err( I18n.ERR_708 ) );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void close() throws Exception
     {
         super.close();

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java Wed Aug 24 21:19:34 2011
@@ -26,8 +26,8 @@ import org.apache.directory.server.i18n.
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.IndexEntry;
 import org.apache.directory.server.xdbm.Store;
-import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Value;
 import org.apache.directory.shared.ldap.model.filter.ApproximateNode;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
@@ -43,6 +43,13 @@ import org.apache.directory.shared.ldap.
  */
 public class ApproximateEvaluator<T, ID extends Comparable<ID>> extends LeafEvaluator<T, ID>
 {
+    /**
+     * Creates a new ApproximateEvaluator
+     * @param node The ApproximateNode
+     * @param db The Store
+     * @param schemaManager The SchemaManager
+     * @throws Exception If the creation failed
+     */
     public ApproximateEvaluator( ApproximateNode<T> node, Store<Entry, ID> db, SchemaManager schemaManager )
         throws Exception
     {
@@ -71,12 +78,18 @@ public class ApproximateEvaluator<T, ID 
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public ApproximateNode<T> getExpression()
     {
         return (ApproximateNode<T>)node;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean evaluateEntry( Entry entry ) throws Exception
     {
         // get the attribute
@@ -116,31 +129,23 @@ public class ApproximateEvaluator<T, ID 
     }
 
 
-    public boolean evaluateId( ID id ) throws Exception
-    {
-        if ( idx != null )
-        {
-            return idx.reverse( id );
-        }
-
-        return evaluateEntry( db.lookup( id ) );
-    }
-
-
-    public boolean evaluate( IndexEntry<?, Entry, ID> indexEntry ) throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
     {
         if ( idx != null )
         {
             return idx.forward( node.getValue().getValue(), indexEntry.getId() );
         }
 
-        Entry entry = indexEntry.getObject();
+        Entry entry = indexEntry.getEntry();
 
         // resuscitate the entry if it has not been and set entry in IndexEntry
         if ( null == entry )
         {
             entry = db.lookup( indexEntry.getId() );
-            indexEntry.setObject( entry );
+            indexEntry.setEntry( entry );
         }
 
         return evaluateEntry( entry );
@@ -158,9 +163,8 @@ public class ApproximateEvaluator<T, ID 
          * appropriate matching rule to perform the check.
          */
 
-        for ( Value value : attribute )
+        for ( Value<?> value : attribute )
         {
-            //noinspection unchecked
             if ( ldapComparator.compare( value.getNormValue(), node.getValue().getNormValue() ) == 0 )
             {
                 return true;

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java Wed Aug 24 21:19:34 2011
@@ -157,14 +157,14 @@ public class DefaultSearchEngine<ID exte
                 effectiveBaseId = db.getEntryId( effectiveBase );
             }
 
-            IndexEntry<ID, Entry, ID> indexEntry = new ForwardIndexEntry<ID, Entry, ID>();
+            IndexEntry<ID, ID> indexEntry = new ForwardIndexEntry<ID, ID>();
             indexEntry.setId( effectiveBaseId );
             optimizer.annotate( filter );
             Evaluator<? extends ExprNode, Entry, ID> evaluator = evaluatorBuilder.build( filter );
 
             if ( evaluator.evaluate( indexEntry ) )
             {
-                return new SingletonIndexCursor<ID, Entry, ID>( indexEntry );
+                return new SingletonIndexCursor<ID, ID>( indexEntry );
             }
             else
             {

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java Wed Aug 24 21:19:34 2011
@@ -43,10 +43,11 @@ import org.apache.directory.shared.ldap.
  */
 public class EqualityCursor<V, ID extends Comparable<ID>> extends AbstractIndexCursor<V, Entry, ID>
 {
+    /** The message for unsupported operations */
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_714 );
 
     /** An equality evaluator for candidates */
-    private final EqualityEvaluator equalityEvaluator;
+    private final EqualityEvaluator<V, ID> equalityEvaluator;
 
     /** Cursor over attribute entry matching filter: set when index present */
     private final IndexCursor<V, Entry, ID> userIdxCursor;
@@ -54,10 +55,13 @@ public class EqualityCursor<V, ID extend
     /** NDN Cursor on all entries in  (set when no index on user attribute) */
     private final IndexCursor<String, Entry, ID> uuidIdxCursor;
 
-    /** used only when ndnIdxCursor is used (no index on attribute) */
-    private boolean available = false;
-
 
+    /**
+     * Creates a new instance of an EqualityCursor
+     * @param db The store
+     * @param equalityEvaluator The EqualityEvaluator
+     * @throws Exception If the creation failed
+     */
     @SuppressWarnings("unchecked")
     public EqualityCursor( Store<Entry, ID> db, EqualityEvaluator<V, ID> equalityEvaluator ) throws Exception
     {
@@ -83,6 +87,15 @@ public class EqualityCursor<V, ID extend
     /**
      * {@inheritDoc}
      */
+    protected String getUnsupportedMessage()
+    {
+        return UNSUPPORTED_MSG;
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
     public boolean available()
     {
         if ( userIdxCursor != null )
@@ -90,7 +103,7 @@ public class EqualityCursor<V, ID extend
             return userIdxCursor.available();
         }
 
-        return available;
+        return super.available();
     }
 
 
@@ -107,7 +120,7 @@ public class EqualityCursor<V, ID extend
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.beforeValue( id, value );
         }
     }
 
@@ -115,7 +128,7 @@ public class EqualityCursor<V, ID extend
     /**
      * {@inheritDoc}
      */
-    public void before( IndexEntry<V, Entry, ID> element ) throws Exception
+    public void before( IndexEntry<V, ID> element ) throws Exception
     {
         checkNotClosed( "before()" );
         
@@ -125,7 +138,7 @@ public class EqualityCursor<V, ID extend
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.before( element );
         }
     }
 
@@ -133,17 +146,18 @@ public class EqualityCursor<V, ID extend
     /**
      * {@inheritDoc}
      */
-    public void afterValue( ID id, V key ) throws Exception
+    public void afterValue( ID id, V value ) throws Exception
     {
         checkNotClosed( "afterValue()" );
         
-        if ( userIdxCursor != null )
+        if ( userIdxCursor
+            != null )
         {
-            userIdxCursor.afterValue( id, key );
+            userIdxCursor.afterValue( id, value );
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.afterValue( id, value );
         }
     }
 
@@ -151,7 +165,7 @@ public class EqualityCursor<V, ID extend
     /**
      * {@inheritDoc}
      */
-    public void after( IndexEntry<V, Entry, ID> element ) throws Exception
+    public void after( IndexEntry<V, ID> element ) throws Exception
     {
         checkNotClosed( "after()" );
         
@@ -161,7 +175,7 @@ public class EqualityCursor<V, ID extend
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.after( element );
         }
     }
 
@@ -182,7 +196,7 @@ public class EqualityCursor<V, ID extend
             uuidIdxCursor.beforeFirst();
         }
 
-        available = false;
+        setAvailable( false );
     }
 
 
@@ -202,7 +216,7 @@ public class EqualityCursor<V, ID extend
             uuidIdxCursor.afterLast();
         }
 
-        available = false;
+        setAvailable( false );
     }
 
 
@@ -231,7 +245,6 @@ public class EqualityCursor<V, ID extend
     /**
      * {@inheritDoc}
      */
-    @SuppressWarnings("unchecked")
     public boolean previous() throws Exception
     {
         if ( userIdxCursor != null )
@@ -242,21 +255,21 @@ public class EqualityCursor<V, ID extend
         while ( uuidIdxCursor.previous() )
         {
             checkNotClosed( "previous()" );
-            IndexEntry<?, Entry, ID> candidate = uuidIdxCursor.get();
+            IndexEntry<?, ID> candidate = uuidIdxCursor.get();
+            
             if ( equalityEvaluator.evaluate( candidate ) )
             {
-                return available = true;
+                return setAvailable( true );
             }
         }
 
-        return available = false;
+        return setAvailable( false );
     }
 
 
     /**
      * {@inheritDoc}
      */
-    @SuppressWarnings("unchecked")
     public boolean next() throws Exception
     {
         if ( userIdxCursor != null )
@@ -267,15 +280,15 @@ public class EqualityCursor<V, ID extend
         while ( uuidIdxCursor.next() )
         {
             checkNotClosed( "next()" );
-            IndexEntry<?, Entry, ID> candidate = uuidIdxCursor.get();
+            IndexEntry<?, ID> candidate = uuidIdxCursor.get();
             
             if ( equalityEvaluator.evaluate( candidate ) )
             {
-                return available = true;
+                return setAvailable( true );
             }
         }
 
-        return available = false;
+        return setAvailable( false );
     }
 
 
@@ -283,7 +296,7 @@ public class EqualityCursor<V, ID extend
      * {@inheritDoc}
      */
     @SuppressWarnings("unchecked")
-    public IndexEntry<V, Entry, ID> get() throws Exception
+    public IndexEntry<V, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
         
@@ -292,9 +305,9 @@ public class EqualityCursor<V, ID extend
             return userIdxCursor.get();
         }
 
-        if ( available )
+        if ( available() )
         {
-            return ( IndexEntry<V, Entry, ID> ) uuidIdxCursor.get();
+            return ( IndexEntry<V, ID> ) uuidIdxCursor.get();
         }
 
         throw new InvalidCursorPositionException( I18n.err( I18n.ERR_708 ) );

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java Wed Aug 24 21:19:34 2011
@@ -26,8 +26,8 @@ import java.util.Iterator;
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.IndexEntry;
 import org.apache.directory.server.xdbm.Store;
-import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Value;
 import org.apache.directory.shared.ldap.model.filter.EqualityNode;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
@@ -92,20 +92,20 @@ public class EqualityEvaluator<T, ID ext
     }
 
 
-    public boolean evaluate( IndexEntry<?, Entry, ID> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
     {
         if ( idx != null )
         {
             return idx.forward( node.getValue().getValue(), indexEntry.getId() );
         }
 
-        Entry entry = indexEntry.getObject();
+        Entry entry = indexEntry.getEntry();
 
         // resuscitate the entry if it has not been and set entry in IndexEntry
         if ( null == entry )
         {
             entry = db.lookup( indexEntry.getId() );
-            indexEntry.setObject( entry );
+            indexEntry.setEntry( entry );
         }
 
         return evaluateEntry( entry );

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java Wed Aug 24 21:19:34 2011
@@ -59,14 +59,17 @@ public class GreaterEqCursor<V, ID exten
      * call to evaluate() which changes the value so it's not referring to
      * the NDN but to the value of the attribute instead.
      */
-    IndexEntry<String, Entry, ID> ndnCandidate;
-
-    /** used in both modes */
-    private boolean available = false;
+    IndexEntry<String, ID> ndnCandidate;
 
 
+    /**
+     * Creates a new instance of an GreaterEqCursor
+     * @param db The store
+     * @param equalityEvaluator The GreaterEqEvaluator
+     * @throws Exception If the creation failed
+     */
     @SuppressWarnings("unchecked")
-    public GreaterEqCursor( Store<Entry, ID> db, GreaterEqEvaluator greaterEqEvaluator ) throws Exception
+    public GreaterEqCursor( Store<Entry, ID> db, GreaterEqEvaluator<V, ID> greaterEqEvaluator ) throws Exception
     {
         this.greaterEqEvaluator = greaterEqEvaluator;
 
@@ -85,13 +88,18 @@ public class GreaterEqCursor<V, ID exten
     }
 
 
-    public boolean available()
+    /**
+     * {@inheritDoc}
+     */
+    protected String getUnsupportedMessage()
     {
-        return available;
+        return UNSUPPORTED_MSG;
     }
 
-
-    @SuppressWarnings("unchecked")
+    
+    /**
+     * {@inheritDoc}
+     */
     public void beforeValue( ID id, V value ) throws Exception
     {
         checkNotClosed( "beforeValue()" );
@@ -114,19 +122,22 @@ public class GreaterEqCursor<V, ID exten
             }
 
             userIdxCursor.beforeValue( id, value );
-            available = false;
+            setAvailable( false );
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.beforeValue( id, value );
         }
     }
 
 
-    @SuppressWarnings("unchecked")
+    /**
+     * {@inheritDoc}
+     */
     public void afterValue( ID id, V value ) throws Exception
     {
         checkNotClosed( "afterValue()" );
+        
         if ( userIdxCursor != null )
         {
             int comparedValue = greaterEqEvaluator.getComparator().compare( value,
@@ -143,28 +154,32 @@ public class GreaterEqCursor<V, ID exten
             if ( comparedValue == 0 )
             {
                 userIdxCursor.afterValue( id, value );
-                available = false;
+                setAvailable( false );
+                
                 return;
             }
             else if ( comparedValue < 0 )
             {
                 beforeFirst();
+                
                 return;
             }
 
             // Element is in the valid range as specified by assertion
             userIdxCursor.afterValue( id, value );
-            available = false;
+            setAvailable( false );
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.afterValue( id, value );
         }
     }
 
 
-    @SuppressWarnings("unchecked")
-    public void before( IndexEntry<V, Entry, ID> element ) throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public void before( IndexEntry<V, ID> element ) throws Exception
     {
         checkNotClosed( "before()" );
         
@@ -186,19 +201,22 @@ public class GreaterEqCursor<V, ID exten
             }
 
             userIdxCursor.before( element );
-            available = false;
+            setAvailable( false );
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.before( element );
         }
     }
 
 
-    @SuppressWarnings("unchecked")
-    public void after( IndexEntry<V, Entry, ID> element ) throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public void after( IndexEntry<V, ID> element ) throws Exception
     {
         checkNotClosed( "after()" );
+        
         if ( userIdxCursor != null )
         {
             int comparedValue = greaterEqEvaluator.getComparator().compare( element.getValue(),
@@ -215,33 +233,40 @@ public class GreaterEqCursor<V, ID exten
             if ( comparedValue == 0 )
             {
                 userIdxCursor.after( element );
-                available = false;
+                setAvailable( false );
+                
                 return;
             }
-            else if ( comparedValue < 0 )
+            
+            if ( comparedValue < 0 )
             {
                 beforeFirst();
+                
                 return;
             }
 
             // Element is in the valid range as specified by assertion
             userIdxCursor.after( element );
-            available = false;
+            setAvailable( false );
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.after( element );
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     @SuppressWarnings("unchecked")
     public void beforeFirst() throws Exception
     {
         checkNotClosed( "beforeFirst()" );
+        
         if ( userIdxCursor != null )
         {
-            IndexEntry<V, Entry, ID> advanceTo = new ForwardIndexEntry<V, Entry, ID>();
+            IndexEntry<V, ID> advanceTo = new ForwardIndexEntry<V, ID>();
             advanceTo.setValue( ( V ) greaterEqEvaluator.getExpression().getValue().getValue() );
             userIdxCursor.before( advanceTo );
         }
@@ -251,13 +276,17 @@ public class GreaterEqCursor<V, ID exten
             ndnCandidate = null;
         }
 
-        available = false;
+        setAvailable( false );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void afterLast() throws Exception
     {
         checkNotClosed( "afterLast()" );
+        
         if ( userIdxCursor != null )
         {
             userIdxCursor.afterLast();
@@ -268,28 +297,39 @@ public class GreaterEqCursor<V, ID exten
             ndnCandidate = null;
         }
 
-        available = false;
+        setAvailable( false );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean first() throws Exception
     {
         beforeFirst();
+        
         return next();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean last() throws Exception
     {
         afterLast();
+        
         return previous();
     }
 
 
-    @SuppressWarnings("unchecked")
+    /**
+     * {@inheritDoc}
+     */
     public boolean previous() throws Exception
     {
         checkNotClosed( "previous()" );
+        
         if ( userIdxCursor != null )
         {
             /*
@@ -299,64 +339,75 @@ public class GreaterEqCursor<V, ID exten
             while ( userIdxCursor.previous() )
             {
                 checkNotClosed( "previous()" );
-                IndexEntry<?, Entry, ID> candidate = userIdxCursor.get();
+                IndexEntry<?, ID> candidate = userIdxCursor.get();
+                
                 if ( greaterEqEvaluator.getComparator().compare( candidate.getValue(),
                     greaterEqEvaluator.getExpression().getValue().getValue() ) >= 0 )
                 {
-                    return available = true;
+                    return setAvailable( true );
                 }
             }
 
-            return available = false;
+            return setAvailable( false );
         }
 
         while ( ndnIdxCursor.previous() )
         {
             checkNotClosed( "previous()" );
             ndnCandidate = ndnIdxCursor.get();
+            
             if ( greaterEqEvaluator.evaluate( ndnCandidate ) )
             {
-                return available = true;
+                return setAvailable( true );
             }
         }
 
-        return available = false;
+        return setAvailable( false );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean next() throws Exception
     {
         checkNotClosed( "next()" );
+        
         if ( userIdxCursor != null )
         {
             /*
              * No need to do the same check that is done in previous() since
              * values are increasing with calls to next().
              */
-            return available = userIdxCursor.next();
+            return setAvailable( userIdxCursor.next() );
         }
 
         while ( ndnIdxCursor.next() )
         {
             checkNotClosed( "next()" );
             ndnCandidate = ndnIdxCursor.get();
+            
             if ( greaterEqEvaluator.evaluate( ndnCandidate ) )
             {
-                return available = true;
+                return setAvailable( true );
             }
         }
 
-        return available = false;
+        return setAvailable( false );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     @SuppressWarnings("unchecked")
-    public IndexEntry<V, Entry, ID> get() throws Exception
+    public IndexEntry<V, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
+        
         if ( userIdxCursor != null )
         {
-            if ( available )
+            if ( available() )
             {
                 return userIdxCursor.get();
             }
@@ -364,15 +415,18 @@ public class GreaterEqCursor<V, ID exten
             throw new InvalidCursorPositionException( I18n.err( I18n.ERR_708 ) );
         }
 
-        if ( available )
+        if ( available() )
         {
-            return ( IndexEntry<V, Entry, ID> ) ndnCandidate;
+            return ( IndexEntry<V, ID> ) ndnCandidate;
         }
 
         throw new InvalidCursorPositionException( I18n.err( I18n.ERR_708 ) );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void close() throws Exception
     {
         super.close();

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java Wed Aug 24 21:19:34 2011
@@ -26,8 +26,8 @@ import org.apache.directory.server.i18n.
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.IndexEntry;
 import org.apache.directory.server.xdbm.Store;
-import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Value;
 import org.apache.directory.shared.ldap.model.filter.GreaterEqNode;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
@@ -87,20 +87,20 @@ public class GreaterEqEvaluator<T, ID ex
     }
 
 
-    public boolean evaluate( IndexEntry<?, Entry, ID> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
     {
         if ( idx != null && idx.isDupsEnabled() )
         {
             return idx.reverseGreaterOrEq( indexEntry.getId(), node.getValue().getValue() );
         }
 
-        Entry entry = indexEntry.getObject();
+        Entry entry = indexEntry.getEntry();
 
         // resuscitate the entry if it has not been and set entry in IndexEntry
         if ( null == entry )
         {
             entry = db.lookup( indexEntry.getId() );
-            indexEntry.setObject( entry );
+            indexEntry.setEntry( entry );
         }
 
         /*
@@ -116,7 +116,7 @@ public class GreaterEqEvaluator<T, ID ex
 
         // if the attribute exists and has a greater than or equal value return true
         //noinspection unchecked
-        if ( attr != null && evaluate( ( IndexEntry<Object, Entry, ID> ) indexEntry, attr ) )
+        if ( attr != null && evaluate( ( IndexEntry<Object, ID> ) indexEntry, attr ) )
         {
             return true;
         }
@@ -138,7 +138,7 @@ public class GreaterEqEvaluator<T, ID ex
                 attr = entry.get( descendant );
 
                 //noinspection unchecked
-                if ( attr != null && evaluate( ( IndexEntry<Object, Entry, ID> ) indexEntry, attr ) )
+                if ( attr != null && evaluate( ( IndexEntry<Object, ID> ) indexEntry, attr ) )
                 {
                     return true;
                 }
@@ -202,7 +202,7 @@ public class GreaterEqEvaluator<T, ID ex
 
     // TODO - determine if comaparator and index entry should have the Value
     // wrapper or the raw normalized value 
-    private boolean evaluate( IndexEntry<Object, Entry, ID> indexEntry, Attribute attribute )
+    private boolean evaluate( IndexEntry<Object, ID> indexEntry, Attribute attribute )
         throws Exception
     {
         /*

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java Wed Aug 24 21:19:34 2011
@@ -59,10 +59,7 @@ public class LessEqCursor<V, ID extends 
      * call to evaluate() which changes the value so it's not referring to
      * the NDN but to the value of the attribute instead.
      */
-    IndexEntry<V, Entry, ID> ndnCandidate;
-
-    /** used in both modes */
-    private boolean available = false;
+    IndexEntry<V, ID> ndnCandidate;
 
 
     @SuppressWarnings("unchecked")
@@ -85,12 +82,18 @@ public class LessEqCursor<V, ID extends 
     }
 
 
-    public boolean available()
+    /**
+     * {@inheritDoc}
+     */
+    protected String getUnsupportedMessage()
     {
-        return available;
+        return UNSUPPORTED_MSG;
     }
 
-
+    
+    /**
+     * {@inheritDoc}
+     */
     public void beforeValue( ID id, V value ) throws Exception
     {
         checkNotClosed( "beforeValue()" );
@@ -117,29 +120,35 @@ public class LessEqCursor<V, ID extends 
             if ( compareValue > 0 )
             {
                 afterLast();
+                
                 return;
             }
             else if ( compareValue == 0 )
             {
                 last();
                 previous();
-                available = false;
+                setAvailable( false );
+                
                 return;
             }
 
             userIdxCursor.beforeValue( id, value );
-            available = false;
+            setAvailable( false );
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.beforeValue( id, value );
         }
     }
 
 
-    public void before( IndexEntry<V, Entry, ID> element ) throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public void before( IndexEntry<V, ID> element ) throws Exception
     {
         checkNotClosed( "before()" );
+        
         if ( userIdxCursor != null )
         {
             /*
@@ -167,23 +176,27 @@ public class LessEqCursor<V, ID extends 
             {
                 last();
                 previous();
-                available = false;
+                setAvailable( false );
                 return;
             }
 
             userIdxCursor.before( element );
-            available = false;
+            setAvailable( false );
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.before( element );
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void afterValue( ID id, V value ) throws Exception
     {
         checkNotClosed( "afterValue()" );
+        
         if ( userIdxCursor != null )
         {
             int comparedValue = lessEqEvaluator.getComparator().compare( value,
@@ -203,23 +216,28 @@ public class LessEqCursor<V, ID extends 
             if ( comparedValue >= 0 )
             {
                 afterLast();
+                
                 return;
             }
 
             // Element is in the valid range as specified by assertion
             userIdxCursor.afterValue( id, value );
-            available = false;
+            setAvailable( false );
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.afterValue( id, value );
         }
     }
 
 
-    public void after( IndexEntry<V, Entry, ID> element ) throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public void after( IndexEntry<V, ID> element ) throws Exception
     {
         checkNotClosed( "after()" );
+        
         if ( userIdxCursor != null )
         {
             int comparedValue = lessEqEvaluator.getComparator().compare( element.getValue(),
@@ -244,11 +262,11 @@ public class LessEqCursor<V, ID extends 
 
             // Element is in the valid range as specified by assertion
             userIdxCursor.after( element );
-            available = false;
+            setAvailable( false );
         }
         else
         {
-            throw new UnsupportedOperationException( UNSUPPORTED_MSG );
+            super.after( element );
         }
     }
 
@@ -266,7 +284,7 @@ public class LessEqCursor<V, ID extends 
             ndnCandidate = null;
         }
 
-        available = false;
+        setAvailable( false );
     }
 
 
@@ -275,7 +293,7 @@ public class LessEqCursor<V, ID extends 
         checkNotClosed( "afterLast()" );
         if ( userIdxCursor != null )
         {
-            IndexEntry<V, Entry, ID> advanceTo = new ForwardIndexEntry<V, Entry, ID>();
+            IndexEntry<V, ID> advanceTo = new ForwardIndexEntry<V, ID>();
             //noinspection unchecked
             advanceTo.setValue( ( V ) lessEqEvaluator.getExpression().getValue().getValue() );
             userIdxCursor.after( advanceTo );
@@ -286,7 +304,7 @@ public class LessEqCursor<V, ID extends 
             ndnCandidate = null;
         }
 
-        available = false;
+        setAvailable( false );
     }
 
 
@@ -315,7 +333,7 @@ public class LessEqCursor<V, ID extends 
              * values are decreasing with calls to previous().  We will
              * always have lesser values.
              */
-            return available = userIdxCursor.previous();
+            return setAvailable( userIdxCursor.previous() );
         }
 
         while ( uuidIdxCursor.previous() )
@@ -324,7 +342,7 @@ public class LessEqCursor<V, ID extends 
             ndnCandidate = uuidIdxCursor.get();
             if ( lessEqEvaluator.evaluate( ndnCandidate ) )
             {
-                return available = true;
+                return setAvailable( true );
             }
             else
             {
@@ -332,13 +350,14 @@ public class LessEqCursor<V, ID extends 
             }
         }
 
-        return available = false;
+        return setAvailable( false );
     }
 
 
     public boolean next() throws Exception
     {
         checkNotClosed( "next()" );
+        
         if ( userIdxCursor != null )
         {
             /*
@@ -350,24 +369,26 @@ public class LessEqCursor<V, ID extends 
             while ( userIdxCursor.next() )
             {
                 checkNotClosed( "next()" );
-                IndexEntry<?, Entry, ID> candidate = userIdxCursor.get();
+                IndexEntry<?, ID> candidate = userIdxCursor.get();
+                
                 if ( lessEqEvaluator.getComparator().compare( candidate.getValue(),
                     lessEqEvaluator.getExpression().getValue().getValue() ) <= 0 )
                 {
-                    return available = true;
+                    return setAvailable( true );
                 }
             }
 
-            return available = false;
+            return setAvailable( false );
         }
 
         while ( uuidIdxCursor.next() )
         {
             checkNotClosed( "next()" );
             ndnCandidate = uuidIdxCursor.get();
+            
             if ( lessEqEvaluator.evaluate( ndnCandidate ) )
             {
-                return available = true;
+                return setAvailable( true );
             }
             else
             {
@@ -375,16 +396,17 @@ public class LessEqCursor<V, ID extends 
             }
         }
 
-        return available = false;
+        return setAvailable( false );
     }
 
 
-    public IndexEntry<V, Entry, ID> get() throws Exception
+    public IndexEntry<V, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
+        
         if ( userIdxCursor != null )
         {
-            if ( available )
+            if ( available() )
             {
                 return userIdxCursor.get();
             }
@@ -392,7 +414,7 @@ public class LessEqCursor<V, ID extends 
             throw new InvalidCursorPositionException( I18n.err( I18n.ERR_708 ) );
         }
 
-        if ( available )
+        if ( available() )
         {
             return ndnCandidate;
         }

Modified: directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java?rev=1161279&r1=1161278&r2=1161279&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java Wed Aug 24 21:19:34 2011
@@ -98,20 +98,20 @@ public class LessEqEvaluator<T, ID exten
     }
 
 
-    public boolean evaluate( IndexEntry<?, Entry, ID> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
     {
         if ( ( idx != null ) && idx.isDupsEnabled() )
         {
             return idx.reverseLessOrEq( indexEntry.getId(), node.getValue().getValue() );
         }
 
-        Entry entry = indexEntry.getObject();
+        Entry entry = indexEntry.getEntry();
 
         // resuscitate the entry if it has not been and set entry in IndexEntry
         if ( null == entry )
         {
             entry = db.lookup( indexEntry.getId() );
-            indexEntry.setObject( entry );
+            indexEntry.setEntry( entry );
         }
 
         if ( null == entry )
@@ -124,7 +124,7 @@ public class LessEqEvaluator<T, ID exten
 
         // if the attribute does not exist just return false
         //noinspection unchecked
-        if ( attr != null && evaluate( ( IndexEntry<Object, Entry, ID> ) indexEntry, attr ) )
+        if ( attr != null && evaluate( ( IndexEntry<Object, ID> ) indexEntry, attr ) )
         {
             return true;
         }
@@ -146,7 +146,7 @@ public class LessEqEvaluator<T, ID exten
                 attr = entry.get( descendant );
 
                 //noinspection unchecked
-                if ( attr != null && evaluate( ( IndexEntry<Object, Entry, ID> ) indexEntry, attr ) )
+                if ( attr != null && evaluate( ( IndexEntry<Object, ID> ) indexEntry, attr ) )
                 {
                     return true;
                 }
@@ -199,7 +199,7 @@ public class LessEqEvaluator<T, ID exten
 
     // TODO - determine if comaparator and index entry should have the Value
     // wrapper or the raw normalized value
-    private boolean evaluate( IndexEntry<Object, Entry, ID> indexEntry, Attribute attribute )
+    private boolean evaluate( IndexEntry<Object, ID> indexEntry, Attribute attribute )
         throws Exception
     {
         /*



Mime
View raw message