public abstract class Tree<T> extends java.lang.Object implements ShallowClone, DeepClone, Visitable<T>
| Modifier and Type | Field and Description |
|---|---|
Tree<T> |
_preceding |
int |
_size |
Tree<T> |
_subsequent |
| Constructor and Description |
|---|
Tree() |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(Visitor4<T> visitor) |
<V extends Tree<T>> |
add(V newNode) |
<V extends Tree<T>> |
add(V newNode,
int cmp)
On adding a node to a tree, if it already exists, and if
Tree#duplicates() returns false, #isDuplicateOf() will be
called.
|
static <T,V extends Tree<T>> |
add(V oldTree,
V newTree) |
Tree |
addedOrExisting()
On adding a node to a tree, if it already exists, and if
Tree#duplicates() returns false, #onAttemptToAddDuplicate()
will be called and the existing node will be stored in
this._preceding.
|
Tree |
balance() |
Tree |
balanceCheckNulls() |
void |
calculateSize() |
abstract int |
compare(Tree a_to)
returns 0, if keys are equal
uses this - other
returns positive if this is greater than a_to
returns negative if this is smaller than a_to
|
java.lang.Object |
deepClone(java.lang.Object a_param)
The parameter allows passing one new object so parent
references can be corrected on children.
|
static Tree |
deepClone(Tree a_tree,
java.lang.Object a_param) |
boolean |
duplicates() |
Tree |
filter(Predicate4 a_filter) |
Tree<T> |
find(Tree<T> template) |
static <T> Tree<T> |
find(Tree<T> inTree,
Tree<T> template) |
static Tree |
findGreaterOrEqual(Tree a_in,
Tree a_finder) |
static Tree |
findSmaller(Tree a_in,
Tree a_node) |
Tree<T> |
first() |
abstract T |
key() |
Tree |
last() |
static Tree |
last(Tree tree) |
int |
nodes() |
Tree |
onAttemptToAddDuplicate(Tree oldNode) |
int |
ownSize() |
Tree |
remove() |
void |
removeChildren() |
Tree |
removeFirst() |
static Tree |
removeLike(Tree from,
Tree a_find) |
<V extends Tree<T>> |
removeLike(V a_find) |
Tree |
removeNode(Tree a_tree) |
java.lang.Object |
root() |
Tree |
rotateLeft() |
Tree |
rotateRight() |
void |
setSizeOwn() |
void |
setSizeOwnPlus(Tree tree) |
void |
setSizeOwnPlus(Tree tree1,
Tree tree2) |
void |
setSizeOwnPreceding() |
void |
setSizeOwnPrecedingSubsequent() |
void |
setSizeOwnSubsequent() |
java.lang.Object |
shallowClone() |
protected Tree |
shallowCloneInternal(Tree tree) |
int |
size() |
static int |
size(Tree a_tree) |
static void |
traverse(Tree tree,
Tree startingNode,
CancellableVisitor4 visitor)
Traverses a tree with a starting point node.
|
static void |
traverse(Tree tree,
Visitor4 visitor) |
<V extends Tree<T>> |
traverse(Visitor4<V> visitor) |
void |
traverseFromLeaves(Visitor4 a_visitor) |
boolean |
wasAddedToTree() |
public static final <T,V extends Tree<T>> V add(V oldTree, V newTree)
public <V extends Tree<T>> V add(V newNode, int cmp)
public Tree addedOrExisting()
public boolean wasAddedToTree()
public final Tree balance()
public Tree balanceCheckNulls()
public void calculateSize()
public abstract int compare(Tree a_to)
public java.lang.Object deepClone(java.lang.Object a_param)
DeepClonepublic boolean duplicates()
public final Tree filter(Predicate4 a_filter)
public final Tree last()
public int nodes()
public int ownSize()
public Tree remove()
public void removeChildren()
public Tree removeFirst()
public final Tree rotateLeft()
public final Tree rotateRight()
public final void setSizeOwn()
public final void setSizeOwnPrecedingSubsequent()
public final void setSizeOwnPreceding()
public final void setSizeOwnSubsequent()
public final void setSizeOwnPlus(Tree tree)
public static int size(Tree a_tree)
public int size()
public static void traverse(Tree tree, Tree startingNode, CancellableVisitor4 visitor)
public final void traverseFromLeaves(Visitor4 a_visitor)
public java.lang.Object shallowClone()
shallowClone in interface ShallowClonepublic abstract T key()
public java.lang.Object root()