Record Class BDIUpdateEvent

java.lang.Object
java.lang.Record
com.tnsai.events.BDIUpdateEvent
Record Components:
eventId - unique identifier for this event
timestamp - when the event occurred
component - the BDI component that changed (BELIEF, DESIRE, INTENTION)
operation - the type of change (ADD, UPDATE, REMOVE)
index - the index in the component list (for ordered collections)
oldValue - the previous value (null for ADD operations)
newValue - the new value (null for REMOVE operations)
All Implemented Interfaces:
TnsAIEvent

public record BDIUpdateEvent(String eventId, Instant timestamp, BDIUpdateEvent.BDIComponent component, BDIUpdateEvent.Operation operation, int index, Object oldValue, Object newValue) extends Record implements TnsAIEvent
Event representing a change in the agent's BDI (Belief-Desire-Intention) state.

BDIUpdateEvent is emitted when:

  • A belief is added, updated, or removed
  • A desire/goal is added, achieved, or abandoned
  • An intention is formed, executed, or dropped

This event enables real-time visualization of agent cognition in UIs.

  • Constructor Details

  • Method Details

    • beliefAdded

      public static BDIUpdateEvent beliefAdded(Object belief)
      Creates a belief add event.
      Parameters:
      belief - the added belief
      Returns:
      new BDIUpdateEvent
    • beliefUpdated

      public static BDIUpdateEvent beliefUpdated(int index, Object oldBelief, Object newBelief)
      Creates a belief update event.
      Parameters:
      index - the belief index
      oldBelief - the old belief
      newBelief - the new belief
      Returns:
      new BDIUpdateEvent
    • beliefRemoved

      public static BDIUpdateEvent beliefRemoved(int index, Object belief)
      Creates a belief remove event.
      Parameters:
      index - the belief index
      belief - the removed belief
      Returns:
      new BDIUpdateEvent
    • desireAdded

      public static BDIUpdateEvent desireAdded(Object desire)
      Creates a desire add event.
      Parameters:
      desire - the added desire
      Returns:
      new BDIUpdateEvent
    • desireUpdated

      public static BDIUpdateEvent desireUpdated(int index, Object oldDesire, Object newDesire)
      Creates a desire update event.
      Parameters:
      index - the desire index
      oldDesire - the old desire
      newDesire - the new desire
      Returns:
      new BDIUpdateEvent
    • desireRemoved

      public static BDIUpdateEvent desireRemoved(int index, Object desire)
      Creates a desire remove event (goal achieved or abandoned).
      Parameters:
      index - the desire index
      desire - the removed desire
      Returns:
      new BDIUpdateEvent
    • intentionAdded

      public static BDIUpdateEvent intentionAdded(Object intention)
      Creates an intention add event.
      Parameters:
      intention - the added intention
      Returns:
      new BDIUpdateEvent
    • intentionUpdated

      public static BDIUpdateEvent intentionUpdated(int index, Object oldIntention, Object newIntention)
      Creates an intention update event.
      Parameters:
      index - the intention index
      oldIntention - the old intention
      newIntention - the new intention
      Returns:
      new BDIUpdateEvent
    • intentionRemoved

      public static BDIUpdateEvent intentionRemoved(int index, Object intention)
      Creates an intention remove event (completed or dropped).
      Parameters:
      index - the intention index
      intention - the removed intention
      Returns:
      new BDIUpdateEvent
    • 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.
    • eventId

      public String eventId()
      Returns the value of the eventId record component.
      Specified by:
      eventId in interface TnsAIEvent
      Returns:
      the value of the eventId record component
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Specified by:
      timestamp in interface TnsAIEvent
      Returns:
      the value of the timestamp record component
    • component

      public BDIUpdateEvent.BDIComponent component()
      Returns the value of the component record component.
      Returns:
      the value of the component record component
    • operation

      public BDIUpdateEvent.Operation operation()
      Returns the value of the operation record component.
      Returns:
      the value of the operation record component
    • index

      public int index()
      Returns the value of the index record component.
      Returns:
      the value of the index record component
    • oldValue

      public Object oldValue()
      Returns the value of the oldValue record component.
      Returns:
      the value of the oldValue record component
    • newValue

      public Object newValue()
      Returns the value of the newValue record component.
      Returns:
      the value of the newValue record component