org.apache.directory.server.core.partition.avl
Class AvlIndex<K,O>

java.lang.Object
  extended by org.apache.directory.server.core.partition.avl.AvlIndex<K,O>
All Implemented Interfaces:
Index<K,O,java.lang.Long>

public class AvlIndex<K,O>
extends java.lang.Object
implements Index<K,O,java.lang.Long>

An Index backed by an AVL Tree.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Field Summary
 
Fields inherited from interface org.apache.directory.server.xdbm.Index
DEFAULT_INDEX_CACHE_SIZE
 
Constructor Summary
AvlIndex()
           
AvlIndex(java.lang.String attributeId)
           
 
Method Summary
 void add(K attrVal, java.lang.Long id)
           
 void close()
          
 int count()
          
 int count(K attrVal)
          
 void drop(K attrVal, java.lang.Long id)
          
 void drop(java.lang.Long id)
          
 boolean forward(K attrVal)
          
 boolean forward(K attrVal, java.lang.Long id)
          
 IndexCursor<K,O,java.lang.Long> forwardCursor()
          
 IndexCursor<K,O,java.lang.Long> forwardCursor(K key)
          
 boolean forwardGreaterOrEq(K attrVal)
          
 boolean forwardGreaterOrEq(K attrVal, java.lang.Long id)
          
 boolean forwardLessOrEq(K attrVal)
          
 boolean forwardLessOrEq(K attrVal, java.lang.Long id)
          
 java.lang.Long forwardLookup(K attrVal)
          
 org.apache.directory.shared.ldap.cursor.Cursor<java.lang.Long> forwardValueCursor(K key)
          
 org.apache.directory.shared.ldap.schema.AttributeType getAttribute()
          
 java.lang.String getAttributeId()
          
 int getCacheSize()
           
 K getNormalized(K attrVal)
          
 java.io.File getWkDirPath()
          this method always returns null for AvlIndex cause this is a in-memory index.
 int greaterThanCount(K attrVal)
          
 boolean isCountExact()
          
 int lessThanCount(K attrVal)
          
 boolean reverse(java.lang.Long id)
          
 boolean reverse(java.lang.Long id, K attrVal)
          
 IndexCursor<K,O,java.lang.Long> reverseCursor()
          
 IndexCursor<K,O,java.lang.Long> reverseCursor(java.lang.Long id)
          
 boolean reverseGreaterOrEq(java.lang.Long id)
          
 boolean reverseGreaterOrEq(java.lang.Long id, K attrVal)
          
 boolean reverseLessOrEq(java.lang.Long id)
          
 boolean reverseLessOrEq(java.lang.Long id, K attrVal)
          
 K reverseLookup(java.lang.Long id)
          
 org.apache.directory.shared.ldap.cursor.Cursor<K> reverseValueCursor(java.lang.Long id)
          
 void setAttributeId(java.lang.String attributeId)
          
 void setCacheSize(int cacheSize)
          throws UnsupportedOperationException cause it is a in-memory index
 void setWkDirPath(java.io.File wkDirPath)
          throws UnsupportedOperationException cause it is a in-memory index
 void sync()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvlIndex

public AvlIndex()

AvlIndex

public AvlIndex(java.lang.String attributeId)
Method Detail

add

public void add(K attrVal,
                java.lang.Long id)
         throws java.lang.Exception
Specified by:
add in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

close

public void close()
           throws java.lang.Exception

Specified by:
close in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

count

public int count()
          throws java.lang.Exception

Specified by:
count in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

count

public int count(K attrVal)
          throws java.lang.Exception

Specified by:
count in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

drop

public void drop(java.lang.Long id)
          throws java.lang.Exception

Specified by:
drop in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

drop

public void drop(K attrVal,
                 java.lang.Long id)
          throws java.lang.Exception

Specified by:
drop in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

forward

public boolean forward(K attrVal)
                throws java.lang.Exception

Specified by:
forward in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

forward

public boolean forward(K attrVal,
                       java.lang.Long id)
                throws java.lang.Exception

Specified by:
forward in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

forwardCursor

public IndexCursor<K,O,java.lang.Long> forwardCursor()
                                              throws java.lang.Exception

Specified by:
forwardCursor in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

forwardCursor

public IndexCursor<K,O,java.lang.Long> forwardCursor(K key)
                                              throws java.lang.Exception

Specified by:
forwardCursor in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

forwardGreaterOrEq

public boolean forwardGreaterOrEq(K attrVal)
                           throws java.lang.Exception

Specified by:
forwardGreaterOrEq in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

forwardGreaterOrEq

public boolean forwardGreaterOrEq(K attrVal,
                                  java.lang.Long id)
                           throws java.lang.Exception

Specified by:
forwardGreaterOrEq in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

forwardLessOrEq

public boolean forwardLessOrEq(K attrVal)
                        throws java.lang.Exception

Specified by:
forwardLessOrEq in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

forwardLessOrEq

public boolean forwardLessOrEq(K attrVal,
                               java.lang.Long id)
                        throws java.lang.Exception

Specified by:
forwardLessOrEq in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

forwardLookup

public java.lang.Long forwardLookup(K attrVal)
                             throws java.lang.Exception

Specified by:
forwardLookup in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

forwardValueCursor

public org.apache.directory.shared.ldap.cursor.Cursor<java.lang.Long> forwardValueCursor(K key)
                                                                                  throws java.lang.Exception

Specified by:
forwardValueCursor in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

getAttribute

public org.apache.directory.shared.ldap.schema.AttributeType getAttribute()

Specified by:
getAttribute in interface Index<K,O,java.lang.Long>

getAttributeId

public java.lang.String getAttributeId()

Specified by:
getAttributeId in interface Index<K,O,java.lang.Long>

getNormalized

public K getNormalized(K attrVal)
                throws java.lang.Exception

Specified by:
getNormalized in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

greaterThanCount

public int greaterThanCount(K attrVal)
                     throws java.lang.Exception

Specified by:
greaterThanCount in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

isCountExact

public boolean isCountExact()

Specified by:
isCountExact in interface Index<K,O,java.lang.Long>

lessThanCount

public int lessThanCount(K attrVal)
                  throws java.lang.Exception

Specified by:
lessThanCount in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

reverse

public boolean reverse(java.lang.Long id)
                throws java.lang.Exception

Specified by:
reverse in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

reverse

public boolean reverse(java.lang.Long id,
                       K attrVal)
                throws java.lang.Exception

Specified by:
reverse in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

reverseCursor

public IndexCursor<K,O,java.lang.Long> reverseCursor()
                                              throws java.lang.Exception

Specified by:
reverseCursor in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

reverseCursor

public IndexCursor<K,O,java.lang.Long> reverseCursor(java.lang.Long id)
                                              throws java.lang.Exception

Specified by:
reverseCursor in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

reverseGreaterOrEq

public boolean reverseGreaterOrEq(java.lang.Long id)
                           throws java.lang.Exception

Specified by:
reverseGreaterOrEq in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

reverseGreaterOrEq

public boolean reverseGreaterOrEq(java.lang.Long id,
                                  K attrVal)
                           throws java.lang.Exception

Specified by:
reverseGreaterOrEq in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

reverseLessOrEq

public boolean reverseLessOrEq(java.lang.Long id)
                        throws java.lang.Exception

Specified by:
reverseLessOrEq in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

reverseLessOrEq

public boolean reverseLessOrEq(java.lang.Long id,
                               K attrVal)
                        throws java.lang.Exception

Specified by:
reverseLessOrEq in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

reverseLookup

public K reverseLookup(java.lang.Long id)
                throws java.lang.Exception

Specified by:
reverseLookup in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

reverseValueCursor

public org.apache.directory.shared.ldap.cursor.Cursor<K> reverseValueCursor(java.lang.Long id)
                                                                     throws java.lang.Exception

Specified by:
reverseValueCursor in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception

setAttributeId

public void setAttributeId(java.lang.String attributeId)

Specified by:
setAttributeId in interface Index<K,O,java.lang.Long>

setWkDirPath

public void setWkDirPath(java.io.File wkDirPath)
throws UnsupportedOperationException cause it is a in-memory index

Specified by:
setWkDirPath in interface Index<K,O,java.lang.Long>

getWkDirPath

public java.io.File getWkDirPath()
this method always returns null for AvlIndex cause this is a in-memory index.

Specified by:
getWkDirPath in interface Index<K,O,java.lang.Long>

setCacheSize

public void setCacheSize(int cacheSize)
throws UnsupportedOperationException cause it is a in-memory index

Specified by:
setCacheSize in interface Index<K,O,java.lang.Long>

getCacheSize

public int getCacheSize()
Specified by:
getCacheSize in interface Index<K,O,java.lang.Long>

sync

public void sync()
          throws java.lang.Exception

Specified by:
sync in interface Index<K,O,java.lang.Long>
Throws:
java.lang.Exception


Copyright © 2003-2010 The Apache Software Foundation. All Rights Reserved.