Class AbstractNode
java.lang.Object
io.crums.util.mrkl.index.AbstractNode
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic TreeIndex.NodeFactory<AbstractNode> Stateless factory for "index" of instances of this class with no additional data. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanEquality semantics are governed by coordinates and handedness.final inthashCode()Consistent with equals(Object).final intindex()Returns this node's index (at this level).final booleanisLeaf()Determines whether this node is at level zero.final booleanisLeft()Determines whether this node is the left child of its parent.abstract booleanisRight()Determines whether this node is the right child of its parent.final intlevel()Returns this node's level.toString()
-
Field Details
-
FACTORY
Stateless factory for "index" of instances of this class with no additional data.
-
-
Constructor Details
-
AbstractNode
Base constructor.- Parameters:
level- ≥ 0 and ≤ 32index- ≥ 0- Throws:
IndexOutOfBoundsException- if the argument constraints are violated
-
-
Method Details
-
level
public final int level()Returns this node's level. Levels are counted from the bottom up: zero at the leaves, maximum at root. -
isLeaf
public final boolean isLeaf()Determines whether this node is at level zero. -
index
public final int index()Returns this node's index (at this level). -
isLeft
public final boolean isLeft()Determines whether this node is the left child of its parent. Note, for closure reasons the root node is defined to be left. -
isRight
public abstract boolean isRight()Determines whether this node is the right child of its parent.Implementations should be marked final.
-
equals
-
hashCode
-
toString
-