Record Class TreeNavigator.Decision

java.lang.Object
java.lang.Record
com.tnsai.intelligence.rag.TreeNavigator.Decision
Record Components:
descend - whether to open nextNodeId()
nextNodeId - the chosen child's id, empty when stopping
Enclosing interface:
TreeNavigator

public static record TreeNavigator.Decision(boolean descend, String nextNodeId) extends Record
What the navigator decided to do at one node.

Stopping is a first-class answer, not a failure. A navigator that has reached the material the query asks about should say so rather than descend until it runs out of budget — the traversal's cost is one model call per level, so an early stop is the difference between a cheap answer and an expensive one.

  • Constructor Details

    • Decision

      public Decision(boolean descend, String nextNodeId)
      Creates a validated decision.
  • Method Details

    • descend

      public static TreeNavigator.Decision descend(String nodeId)
      Descends into the named child.
      Parameters:
      nodeId - id of a node offered in TreeNavigator.Request.candidates()
      Returns:
      the decision
    • stop

      public static TreeNavigator.Decision stop()
      Ends the descent at the current node.
      Returns:
      the decision
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • descend

      public boolean descend()
      Returns the value of the descend record component.
      Returns:
      the value of the descend record component
    • nextNodeId

      public String nextNodeId()
      Returns the value of the nextNodeId record component.
      Returns:
      the value of the nextNodeId record component