Package org.basex.query.util.fingertree
Class FingerTreeBuilder<E>
- java.lang.Object
-
- org.basex.query.util.fingertree.FingerTreeBuilder<E>
-
- Type Parameters:
E
- element type
- All Implemented Interfaces:
Iterable<E>
public final class FingerTreeBuilder<E> extends Object implements Iterable<E>
A builder forFingerTree
s from leaf nodes.- Author:
- BaseX Team 2005-22, BSD License, Leo Woerteler
-
-
Constructor Summary
Constructors Constructor Description FingerTreeBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
append(FingerTree<E,E> tree)
Appends another finger tree to this builder.void
append(Node<E,E> leaf)
Adds a leaf node to the back of the tree.FingerTree<E,E>
freeze()
Builds a finger tree from the current state of this builder.boolean
isEmpty()
Checks if this builder is empty, i.e.Iterator<E>
iterator()
void
prepend(Node<E,E> leaf)
Adds a leaf node to the front of the tree.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Checks if this builder is empty, i.e. if no leaf nodes were added to it.- Returns:
true
if the builder is empty,false
otherwise
-
prepend
public void prepend(Node<E,E> leaf)
Adds a leaf node to the front of the tree.- Parameters:
leaf
- the leaf node to add
-
append
public void append(Node<E,E> leaf)
Adds a leaf node to the back of the tree.- Parameters:
leaf
- the leaf node to add
-
append
public void append(FingerTree<E,E> tree)
Appends another finger tree to this builder.- Parameters:
tree
- finger tree to append
-
freeze
public FingerTree<E,E> freeze()
Builds a finger tree from the current state of this builder.- Returns:
- the resulting finger tree
-
-