Record Class HierarchicalTask

java.lang.Object
java.lang.Record
com.tnsai.coordination.hierarchical.HierarchicalTask

public record HierarchicalTask(String taskId, String parentTaskId, HierarchyLevel level, String description, Map<String,Object> context, HierarchicalTask.TaskStatus status, List<String> subtaskIds, String result, Instant createdAt, Instant completedAt) extends Record
A task within the hierarchical orchestration system.

Tasks flow from Strategic to Tactical to Operational layers, with each layer refining and decomposing the task further.

Since:
0.1.0
  • Constructor Details

    • HierarchicalTask

      public HierarchicalTask(String taskId, String parentTaskId, HierarchyLevel level, String description, Map<String,Object> context, HierarchicalTask.TaskStatus status, List<String> subtaskIds, String result, Instant createdAt, Instant completedAt)
      Creates an instance of a HierarchicalTask record class.
      Parameters:
      taskId - the value for the taskId record component
      parentTaskId - the value for the parentTaskId record component
      level - the value for the level record component
      description - the value for the description record component
      context - the value for the context record component
      status - the value for the status record component
      subtaskIds - the value for the subtaskIds record component
      result - the value for the result record component
      createdAt - the value for the createdAt record component
      completedAt - the value for the completedAt record component
  • Method Details

    • strategic

      public static HierarchicalTask strategic(String description, Map<String,Object> context)
      Creates a new strategic-level task.
    • createTacticalSubtask

      public HierarchicalTask createTacticalSubtask(String description, Map<String,Object> additionalContext)
      Creates a tactical subtask from this task.
    • createOperationalSubtask

      public HierarchicalTask createOperationalSubtask(String description, Map<String,Object> additionalContext)
      Creates an operational subtask from this task.
    • withStatus

      public HierarchicalTask withStatus(HierarchicalTask.TaskStatus newStatus)
      Returns a copy with updated status.
    • withResult

      public HierarchicalTask withResult(String result)
      Returns a copy with result.
    • withSubtasks

      public HierarchicalTask withSubtasks(List<String> subtaskIds)
      Returns a copy with subtask IDs.
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • taskId

      public String taskId()
      Returns the value of the taskId record component.
      Returns:
      the value of the taskId record component
    • parentTaskId

      public String parentTaskId()
      Returns the value of the parentTaskId record component.
      Returns:
      the value of the parentTaskId record component
    • level

      public HierarchyLevel level()
      Returns the value of the level record component.
      Returns:
      the value of the level record component
    • description

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

      public Map<String,Object> context()
      Returns the value of the context record component.
      Returns:
      the value of the context record component
    • status

      public HierarchicalTask.TaskStatus status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • subtaskIds

      public List<String> subtaskIds()
      Returns the value of the subtaskIds record component.
      Returns:
      the value of the subtaskIds record component
    • result

      public String result()
      Returns the value of the result record component.
      Returns:
      the value of the result record component
    • createdAt

      public Instant createdAt()
      Returns the value of the createdAt record component.
      Returns:
      the value of the createdAt record component
    • completedAt

      public Instant completedAt()
      Returns the value of the completedAt record component.
      Returns:
      the value of the completedAt record component