Class StorePatriciaBranchNode
java.lang.Object
com.norswap.nanoeth.trees.patricia.PatriciaNode
com.norswap.nanoeth.trees.patricia.PatriciaBranchNode
com.norswap.nanoeth.trees.patricia.store.StorePatriciaBranchNode
public final class StorePatriciaBranchNode extends PatriciaBranchNode
A branch node usable for store-backed implementation, or for nodes in abridged form.
-
Field Summary
Fields Modifier and Type Field Description byte[][]
childrenCaps
The cap values (i.e.byte[]
value
The value associated with this node (or null).Fields inherited from class com.norswap.nanoeth.trees.patricia.PatriciaNode
cap
-
Constructor Summary
Constructors Constructor Description StorePatriciaBranchNode(byte[] value, byte[][] childrenCaps)
-
Method Summary
Modifier and Type Method Description PatriciaNode
childAt(NodeStore store, int nibble)
Returns the child node with the given starting nibble, or null if there is no such child.byte[]
childCapAt(int nibble)
Returns the cap value ofPatriciaBranchNode.childAt(NodeStore, int)
with parameternibble
, or null if there is no such child.boolean
equals(Object o)
boolean
hasChildAt(int nibble)
Returns true only if the branch node has a child with the given starting nibble.int
hashCode()
String
toString()
byte[]
value()
Returns the value associated with this leaf node, or null if no value is associated.Methods inherited from class com.norswap.nanoeth.trees.patricia.PatriciaBranchNode
add, childAndValueCount, collectEntries, compose, lookup, remove, step
Methods inherited from class com.norswap.nanoeth.trees.patricia.PatriciaNode
cap, merkleRoot, parse
-
Field Details
-
value
The value associated with this node (or null). -
childrenCaps
The cap values (i.e. result of the yellowpaper's node cap function n - equation 196) of all children of this node. Must have size 16.For empty slots in branch nodes,
null
is used.
-
-
Constructor Details
-
StorePatriciaBranchNode
public StorePatriciaBranchNode(byte[] value, byte[][] childrenCaps)
-
-
Method Details
-
value
Description copied from class:PatriciaBranchNode
Returns the value associated with this leaf node, or null if no value is associated.- Specified by:
value
in classPatriciaBranchNode
-
hasChildAt
public boolean hasChildAt(int nibble)Description copied from class:PatriciaBranchNode
Returns true only if the branch node has a child with the given starting nibble.- Specified by:
hasChildAt
in classPatriciaBranchNode
-
childAt
Description copied from class:PatriciaBranchNode
Returns the child node with the given starting nibble, or null if there is no such child.- Specified by:
childAt
in classPatriciaBranchNode
-
childCapAt
Description copied from class:PatriciaBranchNode
Returns the cap value ofPatriciaBranchNode.childAt(NodeStore, int)
with parameternibble
, or null if there is no such child.This is a separate method because in the abridged representation, the children's cap values are stored directly, but not the children themselves.
- Specified by:
childCapAt
in classPatriciaBranchNode
-
equals
-
hashCode
public int hashCode() -
toString
-