mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/ValueTreeCursor.java [38:152]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class ValueTreeCursor<V> extends AbstractCursor<V>
{

    private ValueCursor<V> wrapped;

    private V available;

    // marker to detect the availability (cause Mavibot supports null values also)
    private V notAvailable = ( V ) new Object();


    public ValueTreeCursor( ValueCursor<V> cursor )
    {
        this.wrapped = cursor;
    }


    @Override
    public boolean available()
    {
        return ( available != notAvailable );
    }


    @Override
    public void before( V element ) throws LdapException, CursorException
    {
        throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
    }


    @Override
    public void after( V element ) throws LdapException, CursorException
    {
        throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
    }


    @Override
    public void beforeFirst() throws LdapException, CursorException
    {
    }


    @Override
    public void afterLast() throws LdapException, CursorException
    {
        throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
    }


    @Override
    public boolean first() throws LdapException, CursorException
    {
        throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
    }


    @Override
    public boolean last() throws LdapException, CursorException
    {
        throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
    }


    @Override
    public boolean previous() throws LdapException, CursorException
    {
        try
        {
            if ( wrapped.hasPrev() )
            {
                available = wrapped.prev();
                return true;
            }
            else
            {
                available = notAvailable;
                return false;
            }
        }
        catch ( IOException e )
        {
            throw new CursorException( e );
        }
    }


    @Override
    public boolean next() throws LdapException, CursorException
    {
        try
        {
            if ( wrapped.hasNext() )
            {
                available = wrapped.next();
                return true;
            }
            else
            {
                available = notAvailable;
                return false;
            }
        }
        catch ( IOException e )
        {
            throw new CursorException( e );
        }
    }


    @Override
    public V get() throws CursorException
    {
        return available;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



mavibotv2-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/ValueTreeCursor.java [38:152]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class ValueTreeCursor<V> extends AbstractCursor<V>
{

    private ValueCursor<V> wrapped;

    private V available;

    // marker to detect the availability (cause Mavibot supports null values also)
    private V notAvailable = ( V ) new Object();


    public ValueTreeCursor( ValueCursor<V> cursor )
    {
        this.wrapped = cursor;
    }


    @Override
    public boolean available()
    {
        return ( available != notAvailable );
    }


    @Override
    public void before( V element ) throws LdapException, CursorException
    {
        throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
    }


    @Override
    public void after( V element ) throws LdapException, CursorException
    {
        throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
    }


    @Override
    public void beforeFirst() throws LdapException, CursorException
    {
    }


    @Override
    public void afterLast() throws LdapException, CursorException
    {
        throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
    }


    @Override
    public boolean first() throws LdapException, CursorException
    {
        throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
    }


    @Override
    public boolean last() throws LdapException, CursorException
    {
        throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
    }


    @Override
    public boolean previous() throws LdapException, CursorException
    {
        try
        {
            if ( wrapped.hasPrev() )
            {
                available = wrapped.prev();
                return true;
            }
            else
            {
                available = notAvailable;
                return false;
            }
        }
        catch ( IOException e )
        {
            throw new CursorException( e );
        }
    }


    @Override
    public boolean next() throws LdapException, CursorException
    {
        try
        {
            if ( wrapped.hasNext() )
            {
                available = wrapped.next();
                return true;
            }
            else
            {
                available = notAvailable;
                return false;
            }
        }
        catch ( IOException e )
        {
            throw new CursorException( e );
        }
    }


    @Override
    public V get() throws CursorException
    {
        return available;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



