Package com.valhalla.sdk.tasks.tree
Class Branch
java.lang.Object
com.valhalla.sdk.tasks.tree.Leaf
com.valhalla.sdk.tasks.tree.Branch
- All Implemented Interfaces:
Sleepable
- Direct Known Subclasses:
Root
Decision-tree branch that executes its first valid child in insertion order.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal BranchAppends children in selection order and attaches their parent links.final voidclear()Detaches and removes every child.Returns the branch's current children.longonLoop()Executes the first valid child, or returns a bounded randomized idle delay.Methods inherited from class com.valhalla.sdk.tasks.tree.Leaf
getContext, getParent, getTree, isValid, setParentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.valhalla.sdk.api.util.Sleepable
sleep, sleep, sleepUntil, sleepUntil, sleepUntil, sleepWhile, sleepWhile, sleepWhile
-
Constructor Details
-
Branch
public Branch()
-
-
Method Details
-
addLeaves
Appends children in selection order and attaches their parent links.- Parameters:
leaves- non-null child branches or executable leaves- Returns:
- this branch for fluent registration
-
clear
public final void clear()Detaches and removes every child. -
getChildren
Returns the branch's current children.- Returns:
- immutable snapshot of children in selection order
-
onLoop
public long onLoop()Executes the first valid child, or returns a bounded randomized idle delay.
-