|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.directory.server.core.avltree.AvlTreeMapImpl<K,V>
public class AvlTreeMapImpl<K,V>
An AvlTreeMap implementation with support to store both key and value. This implementation also supports duplicate keys. The values of a same key will be stored in a AvlTree.
Constructor Summary | |
---|---|
AvlTreeMapImpl(java.util.Comparator<K> keyComparator,
java.util.Comparator<V> valueComparator)
Creates a new instance of AVLTreeMap without support for duplicate keys. |
|
AvlTreeMapImpl(java.util.Comparator<K> keyComparator,
java.util.Comparator<V> valueComparator,
boolean allowDuplicates)
|
Method Summary | |
---|---|
LinkedAvlMapNode<K,V> |
find(K key)
Find a LinkedAvlMapNode with the given key value in the tree. |
LinkedAvlMapNode<K,V> |
find(K key,
V value)
Find a LinkedAvlMapNode with the given key and value in the tree. |
LinkedAvlMapNode<K,V> |
findGreater(K key)
Finds a LinkedAvlMapNode |
LinkedAvlMapNode<K,V> |
findGreaterOrEqual(K key)
Finds a LinkedAvlMapNode |
LinkedAvlMapNode<K,V> |
findLess(K key)
Finds a LinkedAvlMapNode |
LinkedAvlMapNode<K,V> |
findLessOrEqual(K key)
Finds a LinkedAvlMapNode |
LinkedAvlMapNode<K,V> |
getFirst()
|
java.util.Comparator<K> |
getKeyComparator()
|
java.util.List<K> |
getKeys()
|
LinkedAvlMapNode<K,V> |
getLast()
|
LinkedAvlMapNode<K,V> |
getRoot()
|
int |
getSize()
returns the number of nodes present in this tree. |
java.util.Comparator<V> |
getValueComparator()
|
V |
insert(K key,
V value)
Inserts a LinkedAvlMapNode with the given key and value. |
boolean |
isDupsAllowed()
tells if the duplicate keys are supported or not. |
boolean |
isEmpty()
Tests if the tree is logically empty. |
void |
printTree()
Prints the contents of AVL tree in pretty format |
SingletonOrOrderedSet<V> |
remove(K key)
Removes a node associated with the given key The entire node will be removed irrespective of whether duplicate keys are enabled or not |
V |
remove(K key,
V value)
Removes the LinkedAvlMapNode present in the tree with the given key and value |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AvlTreeMapImpl(java.util.Comparator<K> keyComparator, java.util.Comparator<V> valueComparator)
comparator1
- the comparator to be used for comparing keyspublic AvlTreeMapImpl(java.util.Comparator<K> keyComparator, java.util.Comparator<V> valueComparator, boolean allowDuplicates)
Method Detail |
---|
public java.util.Comparator<K> getKeyComparator()
getKeyComparator
in interface AvlTreeMap<K,V>
public java.util.Comparator<V> getValueComparator()
getValueComparator
in interface AvlTreeMap<K,V>
public V insert(K key, V value)
insert
in interface AvlTreeMap<K,V>
key
- the item to be insertedvalue
- the value associated with the key
public SingletonOrOrderedSet<V> remove(K key)
remove
in interface AvlTreeMap<K,V>
key
- the key of the node to be removed
public V remove(K key, V value)
remove
in interface AvlTreeMap<K,V>
key
- the key of the node to be removedvalue
- the value of the node
public boolean isEmpty()
isEmpty
in interface AvlTreeMap<K,V>
public int getSize()
getSize
in interface AvlTreeMap<K,V>
public LinkedAvlMapNode<K,V> getRoot()
getRoot
in interface AvlTreeMap<K,V>
public java.util.List<K> getKeys()
getKeys
in interface AvlTreeMap<K,V>
public void printTree()
printTree
in interface AvlTreeMap<K,V>
public LinkedAvlMapNode<K,V> getFirst()
getFirst
in interface AvlTreeMap<K,V>
public LinkedAvlMapNode<K,V> getLast()
getLast
in interface AvlTreeMap<K,V>
public LinkedAvlMapNode<K,V> findGreater(K key)
findGreater
in interface AvlTreeMap<K,V>
key
- the key
public LinkedAvlMapNode<K,V> findGreaterOrEqual(K key)
findGreaterOrEqual
in interface AvlTreeMap<K,V>
key
- the key
public LinkedAvlMapNode<K,V> findLess(K key)
findLess
in interface AvlTreeMap<K,V>
key
- the key
public LinkedAvlMapNode<K,V> findLessOrEqual(K key)
findLessOrEqual
in interface AvlTreeMap<K,V>
key
- the key
public LinkedAvlMapNode<K,V> find(K key)
find
in interface AvlTreeMap<K,V>
key
- the key to find
public LinkedAvlMapNode<K,V> find(K key, V value)
find
in interface AvlTreeMap<K,V>
key
- the key of the nodevalue
- the value of the node
public boolean isDupsAllowed()
isDupsAllowed
in interface AvlTreeMap<K,V>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |