Record Class ComponentTreeNode

java.lang.Object
java.lang.Record
com.botwithus.bot.api.model.ComponentTreeNode
Record Components:
component - the decoded component at this node
parentIndex - index of this node's parent in the same list, or -1 for the root

public record ComponentTreeNode(Component component, int parentIndex) extends Record
One node of a flattened interface subtree returned by GameAPI.getInterfaceTree(int, int) — the raw decode of a single get_interface_tree entry.

parentIndex references an earlier slot in the same list (-1 for the root), so a consumer can rebuild the tree without a second lookup. The producer walks the live Component* children vectors, so a child's own interface id rides along in component.ifaceId() — the tree stays correct across mounted sub-interface boundaries, which per-node GameAPI.getStaticChildren(int, int) cannot follow.

Most scripts never touch this directly — the Components facade wraps it into a navigable ComponentTree.

  • Constructor Details

    • ComponentTreeNode

      public ComponentTreeNode(Component component, int parentIndex)
      Creates an instance of a ComponentTreeNode record class.
      Parameters:
      component - the value for the component record component
      parentIndex - the value for the parentIndex record component
  • Method Details

    • 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 the compare method from their corresponding wrapper classes.
      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.
    • component

      public Component component()
      Returns the value of the component record component.
      Returns:
      the value of the component record component
    • parentIndex

      public int parentIndex()
      Returns the value of the parentIndex record component.
      Returns:
      the value of the parentIndex record component