Class Tree<T>

    • Field Detail

      • _preceding

        public Tree<T> _preceding
      • _size

        public int _size
      • _subsequent

        public Tree<T> _subsequent
    • Constructor Detail

      • Tree

        public Tree()
    • Method Detail

      • add

        public static final <T,​V extends Tree<T>> V add​(V oldTree,
                                                              V newTree)
      • add

        public final <V extends Tree<T>> V add​(V newNode)
      • add

        public <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.
      • addedOrExisting

        public 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.
      • wasAddedToTree

        public boolean wasAddedToTree()
      • balance

        public final Tree balance()
      • balanceCheckNulls

        public Tree balanceCheckNulls()
      • calculateSize

        public void calculateSize()
      • compare

        public 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
      • deepClone

        public static Tree deepClone​(Tree a_tree,
                                     java.lang.Object a_param)
      • deepClone

        public java.lang.Object deepClone​(java.lang.Object a_param)
        Description copied from interface: DeepClone
        The parameter allows passing one new object so parent references can be corrected on children.
        Specified by:
        deepClone in interface DeepClone
      • duplicates

        public boolean duplicates()
      • find

        public static final <T> Tree<T> find​(Tree<T> inTree,
                                             Tree<T> template)
      • find

        public final Tree<T> find​(Tree<T> template)
      • findGreaterOrEqual

        public static final Tree findGreaterOrEqual​(Tree a_in,
                                                    Tree a_finder)
      • findSmaller

        public static final Tree findSmaller​(Tree a_in,
                                             Tree a_node)
      • first

        public final Tree<T> first()
      • last

        public static Tree last​(Tree tree)
      • last

        public final Tree last()
      • onAttemptToAddDuplicate

        public Tree onAttemptToAddDuplicate​(Tree oldNode)
      • nodes

        public int nodes()
        Returns:
        the number of nodes in this tree for balancing
      • ownSize

        public int ownSize()
      • remove

        public Tree remove()
      • removeChildren

        public void removeChildren()
      • removeFirst

        public Tree removeFirst()
      • removeLike

        public static Tree removeLike​(Tree from,
                                      Tree a_find)
      • removeLike

        public final <V extends Tree<T>> V removeLike​(V a_find)
      • removeNode

        public final Tree removeNode​(Tree a_tree)
      • rotateLeft

        public final Tree rotateLeft()
      • rotateRight

        public final Tree rotateRight()
      • setSizeOwn

        public final void setSizeOwn()
      • setSizeOwnPrecedingSubsequent

        public final void setSizeOwnPrecedingSubsequent()
      • setSizeOwnPreceding

        public final void setSizeOwnPreceding()
      • setSizeOwnSubsequent

        public final void setSizeOwnSubsequent()
      • setSizeOwnPlus

        public final void setSizeOwnPlus​(Tree tree)
      • setSizeOwnPlus

        public final void setSizeOwnPlus​(Tree tree1,
                                         Tree tree2)
      • size

        public static int size​(Tree a_tree)
      • size

        public int size()
        Returns:
        the number of objects represented.
      • traverse

        public static final void traverse​(Tree tree,
                                          Visitor4 visitor)
      • traverse

        public 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.
      • traverse

        public final <V extends Tree<T>> void traverse​(Visitor4<V> visitor)
      • traverseFromLeaves

        public final void traverseFromLeaves​(Visitor4 a_visitor)
      • shallowCloneInternal

        protected Tree shallowCloneInternal​(Tree tree)
      • key

        public abstract T key()
      • root

        public java.lang.Object root()
      • depth

        public static int depth​(Tree tree)