Package com.db4o.foundation
Class Tree<T>
- java.lang.Object
- 
- com.db4o.foundation.Tree<T>
 
- 
- All Implemented Interfaces:
- DeepClone,- ShallowClone,- Visitable<T>
 - Direct Known Subclasses:
- QPending,- TreeInt,- TreeObject
 
 public abstract class Tree<T> extends java.lang.Object implements ShallowClone, DeepClone, Visitable<T> 
- 
- 
Field SummaryFields Modifier and Type Field Description Tree<T>_precedingint_sizeTree<T>_subsequent
 - 
Constructor SummaryConstructors Constructor Description Tree()
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaccept(Visitor4<T> visitor)<V extends Tree<T>>
 Vadd(V newNode)<V extends Tree<T>>
 Vadd(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>>
 Vadd(V oldTree, V newTree)TreeaddedOrExisting()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.Treebalance()TreebalanceCheckNulls()voidcalculateSize()abstract intcompare(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_tostatic TreedeepClone(Tree a_tree, java.lang.Object a_param)java.lang.ObjectdeepClone(java.lang.Object a_param)The parameter allows passing one new object so parent references can be corrected on children.static intdepth(Tree tree)booleanduplicates()Treefilter(Predicate4 a_filter)Tree<T>find(Tree<T> template)static <T> Tree<T>find(Tree<T> inTree, Tree<T> template)static TreefindGreaterOrEqual(Tree a_in, Tree a_finder)static TreefindSmaller(Tree a_in, Tree a_node)Tree<T>first()abstract Tkey()Treelast()static Treelast(Tree tree)intnodes()TreeonAttemptToAddDuplicate(Tree oldNode)intownSize()Treeremove()voidremoveChildren()TreeremoveFirst()static TreeremoveLike(Tree from, Tree a_find)<V extends Tree<T>>
 VremoveLike(V a_find)TreeremoveNode(Tree a_tree)java.lang.Objectroot()TreerotateLeft()TreerotateRight()voidsetSizeOwn()voidsetSizeOwnPlus(Tree tree)voidsetSizeOwnPlus(Tree tree1, Tree tree2)voidsetSizeOwnPreceding()voidsetSizeOwnPrecedingSubsequent()voidsetSizeOwnSubsequent()java.lang.ObjectshallowClone()protected TreeshallowCloneInternal(Tree tree)intsize()static intsize(Tree a_tree)static voidtraverse(Tree tree, Tree startingNode, CancellableVisitor4 visitor)Traverses a tree with a starting point node.static voidtraverse(Tree tree, Visitor4 visitor)<V extends Tree<T>>
 voidtraverse(Visitor4<V> visitor)voidtraverseFromLeaves(Visitor4 a_visitor)booleanwasAddedToTree()
 
- 
- 
- 
Method Detail- 
addpublic static final <T,V extends Tree<T>> V add(V oldTree, V newTree) 
 - 
addpublic <V extends Tree<T>> V 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. The added node can then be asked for the node that prevails in the tree using #duplicateOrThis(). This mechanism allows doing find() and add() in one run.
 - 
addedOrExistingpublic 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. This node node can then be asked for the node that prevails in the tree on adding, using the #addedOrExisting() method. This mechanism allows doing find() and add() in one run.
 - 
wasAddedToTreepublic boolean wasAddedToTree() 
 - 
balancepublic final Tree balance() 
 - 
balanceCheckNullspublic Tree balanceCheckNulls() 
 - 
calculateSizepublic void calculateSize() 
 - 
comparepublic 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
 - 
deepClonepublic java.lang.Object deepClone(java.lang.Object a_param) Description copied from interface:DeepCloneThe parameter allows passing one new object so parent references can be corrected on children.
 - 
duplicatespublic boolean duplicates() 
 - 
filterpublic final Tree filter(Predicate4 a_filter) 
 - 
lastpublic final Tree last() 
 - 
nodespublic int nodes() - Returns:
- the number of nodes in this tree for balancing
 
 - 
ownSizepublic int ownSize() 
 - 
removepublic Tree remove() 
 - 
removeChildrenpublic void removeChildren() 
 - 
removeFirstpublic Tree removeFirst() 
 - 
rotateLeftpublic final Tree rotateLeft() 
 - 
rotateRightpublic final Tree rotateRight() 
 - 
setSizeOwnpublic final void setSizeOwn() 
 - 
setSizeOwnPrecedingSubsequentpublic final void setSizeOwnPrecedingSubsequent() 
 - 
setSizeOwnPrecedingpublic final void setSizeOwnPreceding() 
 - 
setSizeOwnSubsequentpublic final void setSizeOwnSubsequent() 
 - 
setSizeOwnPluspublic final void setSizeOwnPlus(Tree tree) 
 - 
sizepublic static int size(Tree a_tree) 
 - 
sizepublic int size() - Returns:
- the number of objects represented.
 
 - 
traversepublic static void traverse(Tree tree, Tree startingNode, CancellableVisitor4 visitor) Traverses a tree with a starting point node. If there is no exact match for the starting node, the next higher will be taken.
 - 
traverseFromLeavespublic final void traverseFromLeaves(Visitor4 a_visitor) 
 - 
shallowClonepublic java.lang.Object shallowClone() - Specified by:
- shallowClonein interface- ShallowClone
 
 - 
keypublic abstract T key() 
 - 
rootpublic java.lang.Object root() 
 - 
depthpublic static int depth(Tree tree) 
 
- 
 
-