Class TupleKeyCountTree

java.lang.Object
com.apple.foundationdb.clientlog.TupleKeyCountTree

@API(EXPERIMENTAL) public class TupleKeyCountTree extends Object
A tree of occurrence counts tuple-encoded keys.
  • Constructor Details

    • TupleKeyCountTree

      public TupleKeyCountTree()
    • TupleKeyCountTree

      public TupleKeyCountTree(@Nullable TupleKeyCountTree parent, @Nonnull byte[] bytes, @Nullable Object object)
  • Method Details

    • getBytes

      @Nonnull public byte[] getBytes()
    • hasObject

      public boolean hasObject()
    • getObject

      @Nullable public Object getObject()
    • add

      public void add(@Nonnull Tuple tuple)
      Add the given tuple to the tree. Each element is added to the next deeper level in the tree, incrementing the count as it goes.
      Parameters:
      tuple - the tuple to add
    • add

      public void add(@Nonnull byte[] packed)
      Add encoded tuple bytes to the tree.
      Parameters:
      packed - the packed form of a tuple to be parsed and added to the tree
    • addPrefixChild

      @Nonnull public TupleKeyCountTree addPrefixChild(@Nonnull Object prefix)
      Add a non-tuple object to the root of the tree.
      Parameters:
      prefix - an object for the top level child of the tree
      Returns:
      a subtree for the given object
    • newPrefixChild

      @Nonnull protected TupleKeyCountTree newPrefixChild(@Nonnull byte[] prefixBytes, @Nonnull Object prefix)
    • newChild

      @Nonnull protected TupleKeyCountTree newChild(@Nonnull byte[] childBytes, @Nonnull Object object)
    • getCount

      public int getCount()
    • getParent

      @Nullable public TupleKeyCountTree getParent()
    • getChildren

      @Nonnull public Collection<TupleKeyCountTree> getChildren()
    • isVisible

      public boolean isVisible()
    • setVisible

      public void setVisible(boolean visible)
    • hideLessThanFraction

      public void hideLessThanFraction(double fraction)
      Hide tree nodes that do not have counts at least as great as the given fraction of their parent node.
      Parameters:
      fraction - the threshold count fraction
    • printTree

      public void printTree(@Nonnull TupleKeyCountTree.Printer printer, @Nullable String collapseSeparator)
      Print this tree to the given printer.
      Parameters:
      printer - the printer to be called for each visible level of the tree
      collapseSeparator - a string to be used to separate the printed forms of levels with only a single child
    • printTree

      protected void printTree(int depth, int nancestors, @Nonnull TupleKeyCountTree.Printer printer, @Nullable String collapseSeparator)
    • toString

      public String toString()
      Overrides:
      toString in class Object