Package com.tnsai.planning
Record Class PlanningGoal
java.lang.Object
java.lang.Record
com.tnsai.planning.PlanningGoal
- Record Components:
name- unique goal identifiercondition- condition expression for satisfaction checkpriority- goal priority (higher = more important)description- human-readable descriptionpersistent- whether goal persists after achievementdeadline- deadline in ticks (-1 for no deadline)
public record PlanningGoal(String name, String condition, com.tnsai.enums.agent.Priority priority, String description, boolean persistent, int deadline)
extends Record
Runtime representation of a planning goal.
Created from Goal annotations at runtime.
- Author:
- TnsAI Team
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPlanningGoal(String name, String condition, com.tnsai.enums.agent.Priority priority, String description, boolean persistent, int deadline) Creates an instance of aPlanningGoalrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconditionrecord component.intdeadline()Returns the value of thedeadlinerecord component.Returns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanChecks if this goal has a deadline.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.static PlanningGoalCreates a simple goal with defaults.static PlanningGoalCreates a goal with priority.booleanReturns the value of thepersistentrecord component.com.tnsai.enums.agent.Prioritypriority()Returns the value of thepriorityrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PlanningGoal
public PlanningGoal(String name, String condition, com.tnsai.enums.agent.Priority priority, String description, boolean persistent, int deadline) Creates an instance of aPlanningGoalrecord class.- Parameters:
name- the value for thenamerecord componentcondition- the value for theconditionrecord componentpriority- the value for thepriorityrecord componentdescription- the value for thedescriptionrecord componentpersistent- the value for thepersistentrecord componentdeadline- the value for thedeadlinerecord component
-
-
Method Details
-
of
Creates a simple goal with defaults.- Parameters:
name- goal namecondition- satisfaction condition- Returns:
- new PlanningGoal with default priority and persistence
-
of
public static PlanningGoal of(String name, String condition, com.tnsai.enums.agent.Priority priority) Creates a goal with priority.- Parameters:
name- goal namecondition- satisfaction conditionpriority- goal priority- Returns:
- new PlanningGoal
-
hasDeadline
public boolean hasDeadline()Checks if this goal has a deadline.- Returns:
- true if deadline is set
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
condition
Returns the value of theconditionrecord component.- Returns:
- the value of the
conditionrecord component
-
priority
public com.tnsai.enums.agent.Priority priority()Returns the value of thepriorityrecord component.- Returns:
- the value of the
priorityrecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
persistent
public boolean persistent()Returns the value of thepersistentrecord component.- Returns:
- the value of the
persistentrecord component
-
deadline
public int deadline()Returns the value of thedeadlinerecord component.- Returns:
- the value of the
deadlinerecord component
-