Record Class Desire

java.lang.Object
java.lang.Record
com.tnsai.models.agent.Desire
Record Components:
objective - the goal description
priority - the priority level
rationale - the reasoning behind this desire
All Implemented Interfaces:
Comparable<Desire>

public record Desire(String objective, Priority priority, String rationale) extends Record implements Comparable<Desire>
Represents a desire or goal that an agent wants to achieve.

In the BDI (Belief-Desire-Intention) architecture, desires represent the agent's goals and objectives. Desires have a priority level and optional rationale, allowing the agent to prioritize when multiple goals conflict.

BDI Architecture Context

  • Belief - What the agent knows about the world
  • Desires (this class) - What the agent wants to achieve
  • Intention - What the agent is committed to doing

Usage Examples


 Desire accuracy = new Desire(
     "Provide accurate information",
     Priority.CRITICAL,
     "User trust depends on accuracy"
 );
 

This record is immutable and thread-safe.

See Also:
  • Constructor Details

    • Desire

      public Desire(String objective, Priority priority, String rationale)
      Creates an instance of a Desire record class.
      Parameters:
      objective - the value for the objective record component
      priority - the value for the priority record component
      rationale - the value for the rationale record component
  • Method Details

    • compareTo

      public int compareTo(Desire other)
      Specified by:
      compareTo in interface Comparable<Desire>
    • 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.
    • objective

      public String objective()
      Returns the value of the objective record component.
      Returns:
      the value of the objective record component
    • priority

      public Priority priority()
      Returns the value of the priority record component.
      Returns:
      the value of the priority record component
    • rationale

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