Record Class SubGoal

java.lang.Object
java.lang.Record
com.tnsai.coordination.planning.SubGoal
Record Components:
goalName - unique name of this sub-goal
parentGoal - the parent goal this was decomposed from
assigneeId - ID of the agent assigned to this sub-goal
phase - execution phase (0-based); same-phase sub-goals run in parallel
dependencies - set of sub-goal names this depends on (must complete first)
description - human-readable description of what this sub-goal achieves

public record SubGoal(String goalName, String parentGoal, String assigneeId, int phase, Set<String> dependencies, String description) extends Record
A sub-goal decomposed from a parent goal, assigned to a specific agent.

Sub-goals have an execution phase: sub-goals in the same phase can execute in parallel, while phases execute sequentially.

  • Constructor Details

    • SubGoal

      public SubGoal(String goalName, String parentGoal, String assigneeId, int phase, Set<String> dependencies, String description)
      Creates an instance of a SubGoal record class.
      Parameters:
      goalName - the value for the goalName record component
      parentGoal - the value for the parentGoal record component
      assigneeId - the value for the assigneeId record component
      phase - the value for the phase record component
      dependencies - the value for the dependencies record component
      description - the value for the description record component
  • Method Details

    • of

      public static SubGoal of(String goalName, String parentGoal, String assigneeId, int phase)
      Creates a sub-goal with no dependencies.
    • of

      public static SubGoal of(String goalName, String parentGoal, String assigneeId, int phase, Set<String> dependencies, String description)
      Creates a sub-goal with dependencies and description.
    • isIndependent

      public boolean isIndependent()
      Returns true if this sub-goal has no dependencies.
    • 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.
    • goalName

      public String goalName()
      Returns the value of the goalName record component.
      Returns:
      the value of the goalName record component
    • parentGoal

      public String parentGoal()
      Returns the value of the parentGoal record component.
      Returns:
      the value of the parentGoal record component
    • assigneeId

      public String assigneeId()
      Returns the value of the assigneeId record component.
      Returns:
      the value of the assigneeId record component
    • phase

      public int phase()
      Returns the value of the phase record component.
      Returns:
      the value of the phase record component
    • dependencies

      public Set<String> dependencies()
      Returns the value of the dependencies record component.
      Returns:
      the value of the dependencies record component
    • description

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