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 for FingerTrees from leaf nodes.
Author:
BaseX Team 2005-21, BSD License, Leo Woerteler
  • Constructor Details

    • FingerTreeBuilder

      public FingerTreeBuilder()
  • Method Details

    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • iterator

      public Iterator<E> iterator()
      Specified by:
      iterator in interface Iterable<E>