Package com.apple.foundationdb.clientlog
Class TupleKeyCountTree
java.lang.Object
com.apple.foundationdb.clientlog.TupleKeyCountTree
A tree of occurrence counts tuple-encoded keys.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(byte[] packed) Add encoded tuple bytes to the tree.voidAdd the given tuple to the tree.addPrefixChild(Object prefix) Add a non-tuple object to the root of the tree.byte[]getBytes()intgetCount()booleanvoidhideLessThanFraction(double fraction) Hide tree nodes that do not have counts at least as great as the given fraction of their parent node.booleanprotected TupleKeyCountTreeprotected TupleKeyCountTreenewPrefixChild(byte[] prefixBytes, Object prefix) protected voidprintTree(int depth, int nancestors, TupleKeyCountTree.Printer printer, String collapseSeparator) voidprintTree(TupleKeyCountTree.Printer printer, String collapseSeparator) Print this tree to the given printer.voidsetVisible(boolean visible) toString()
-
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
-
add
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
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
-
getCount
public int getCount() -
getParent
-
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 treecollapseSeparator- 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
-