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

public abstract class Branch extends Leaf
Decision-tree branch that executes its first valid child in insertion order.
  • Constructor Details

    • Branch

      public Branch()
  • Method Details

    • addLeaves

      public final Branch addLeaves(Leaf... leaves)
      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

      public final List<Leaf> 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.
      Specified by:
      onLoop in class Leaf
      Returns:
      selected child delay, or an idle delay from 50 through 1,000 milliseconds