Constructor and Description |
---|
AvlTree() |
Modifier and Type | Method and Description |
---|---|
static <TNode extends AvlUtil.AvlNode> |
get(TNode root,
Object key,
AvlUtil.AvlKeyComparator<TNode> keyComparator) |
static <TNode extends AvlUtil.AvlNode> |
getFirst(TNode root) |
static <TNode extends AvlUtil.AvlNode> |
getLast(TNode root) |
static <TNode extends AvlUtil.AvlNode> |
insert(TNode root,
Object key,
AvlUtil.AvlKeyComparator<TNode> keyComparator,
AvlUtil.AvlInsertOrReplace<TNode> insertOrReplace)
Insert a node into the tree.
|
static <TNode extends AvlUtil.AvlNode> |
insert(TNode root,
TNode node)
Insert a node into the tree.
|
static <TNode extends AvlUtil.AvlNode> |
remove(TNode root,
Object key,
AvlUtil.AvlKeyComparator<TNode> keyComparator)
Removes the node matching the specified key from the tree
|
static <TNode extends AvlUtil.AvlNode> |
remove(TNode root,
Object key,
AvlUtil.AvlKeyComparator<TNode> keyComparator,
AtomicBoolean removed)
Removes the node matching the specified key from the tree
|
static <TNode extends AvlUtil.AvlNode> |
visit(TNode root,
AvlUtil.AvlNodeVisitor<TNode> visitor)
Visit each node of the tree
|
public static <TNode extends AvlUtil.AvlNode> TNode get(TNode root, Object key, AvlUtil.AvlKeyComparator<TNode> keyComparator)
root
- the current root of the treekey
- the key for the node we are trying to findkeyComparator
- the comparator to use to match node and keypublic static <TNode extends AvlUtil.AvlNode> TNode getFirst(TNode root)
root
- the current root of the treepublic static <TNode extends AvlUtil.AvlNode> TNode getLast(TNode root)
root
- the current root of the treepublic static <TNode extends AvlUtil.AvlNode> TNode insert(TNode root, TNode node)
root
- the current root of the treenode
- the node to insertpublic static <TNode extends AvlUtil.AvlNode> TNode insert(TNode root, Object key, AvlUtil.AvlKeyComparator<TNode> keyComparator, AvlUtil.AvlInsertOrReplace<TNode> insertOrReplace)
root
- the current root of the treekey
- the key for the node we are trying to insertkeyComparator
- the comparator to use to match node and keyinsertOrReplace
- the class to use to insert or replace the nodepublic static <TNode extends AvlUtil.AvlNode> TNode remove(TNode root, Object key, AvlUtil.AvlKeyComparator<TNode> keyComparator)
root
- the current root of the treekey
- the key for the node we are trying to findkeyComparator
- the comparator to use to match node and keypublic static <TNode extends AvlUtil.AvlNode> TNode remove(TNode root, Object key, AvlUtil.AvlKeyComparator<TNode> keyComparator, AtomicBoolean removed)
root
- the current root of the treekey
- the key for the node we are trying to findkeyComparator
- the comparator to use to match node and keyremoved
- will be set to true if the node was found and removed, otherwise falsepublic static <TNode extends AvlUtil.AvlNode> void visit(TNode root, AvlUtil.AvlNodeVisitor<TNode> visitor)
root
- the current root of the treevisitor
- the AvlNodeVisitor instanceCopyright © 2007–2019 Cloudera. All rights reserved.