Package com.tnsai.events
Record Class BDIUpdateEvent
java.lang.Object
java.lang.Record
com.tnsai.events.BDIUpdateEvent
- Record Components:
eventId- unique identifier for this eventtimestamp- when the event occurredcomponent- 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe BDI component types.static enumThe operation types for BDI updates. -
Constructor Summary
ConstructorsConstructorDescriptionBDIUpdateEvent(String eventId, Instant timestamp, BDIUpdateEvent.BDIComponent component, BDIUpdateEvent.Operation operation, int index, Object oldValue, Object newValue) Creates an instance of aBDIUpdateEventrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic BDIUpdateEventbeliefAdded(Object belief) Creates a belief add event.static BDIUpdateEventbeliefRemoved(int index, Object belief) Creates a belief remove event.static BDIUpdateEventbeliefUpdated(int index, Object oldBelief, Object newBelief) Creates a belief update event.Returns the value of thecomponentrecord component.static BDIUpdateEventdesireAdded(Object desire) Creates a desire add event.static BDIUpdateEventdesireRemoved(int index, Object desire) Creates a desire remove event (goal achieved or abandoned).static BDIUpdateEventdesireUpdated(int index, Object oldDesire, Object newDesire) Creates a desire update event.final booleanIndicates whether some other object is "equal to" this one.eventId()Returns the value of theeventIdrecord component.final inthashCode()Returns a hash code value for this object.intindex()Returns the value of theindexrecord component.static BDIUpdateEventintentionAdded(Object intention) Creates an intention add event.static BDIUpdateEventintentionRemoved(int index, Object intention) Creates an intention remove event (completed or dropped).static BDIUpdateEventintentionUpdated(int index, Object oldIntention, Object newIntention) Creates an intention update event.newValue()Returns the value of thenewValuerecord component.oldValue()Returns the value of theoldValuerecord component.Returns the value of theoperationrecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface com.tnsai.events.TnsAIEvent
eventType
-
Constructor Details
-
BDIUpdateEvent
public BDIUpdateEvent(String eventId, Instant timestamp, BDIUpdateEvent.BDIComponent component, BDIUpdateEvent.Operation operation, int index, Object oldValue, Object newValue) Creates an instance of aBDIUpdateEventrecord class.- Parameters:
eventId- the value for theeventIdrecord componenttimestamp- the value for thetimestamprecord componentcomponent- the value for thecomponentrecord componentoperation- the value for theoperationrecord componentindex- the value for theindexrecord componentoldValue- the value for theoldValuerecord componentnewValue- the value for thenewValuerecord component
-
-
Method Details
-
beliefAdded
Creates a belief add event.- Parameters:
belief- the added belief- Returns:
- new BDIUpdateEvent
-
beliefUpdated
Creates a belief update event.- Parameters:
index- the belief indexoldBelief- the old beliefnewBelief- the new belief- Returns:
- new BDIUpdateEvent
-
beliefRemoved
Creates a belief remove event.- Parameters:
index- the belief indexbelief- the removed belief- Returns:
- new BDIUpdateEvent
-
desireAdded
Creates a desire add event.- Parameters:
desire- the added desire- Returns:
- new BDIUpdateEvent
-
desireUpdated
Creates a desire update event.- Parameters:
index- the desire indexoldDesire- the old desirenewDesire- the new desire- Returns:
- new BDIUpdateEvent
-
desireRemoved
Creates a desire remove event (goal achieved or abandoned).- Parameters:
index- the desire indexdesire- the removed desire- Returns:
- new BDIUpdateEvent
-
intentionAdded
Creates an intention add event.- Parameters:
intention- the added intention- Returns:
- new BDIUpdateEvent
-
intentionUpdated
Creates an intention update event.- Parameters:
index- the intention indexoldIntention- the old intentionnewIntention- the new intention- Returns:
- new BDIUpdateEvent
-
intentionRemoved
Creates an intention remove event (completed or dropped).- Parameters:
index- the intention indexintention- the removed intention- Returns:
- new BDIUpdateEvent
-
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 '=='. -
eventId
Returns the value of theeventIdrecord component.- Specified by:
eventIdin interfaceTnsAIEvent- Returns:
- the value of the
eventIdrecord component
-
timestamp
Returns the value of thetimestamprecord component.- Specified by:
timestampin interfaceTnsAIEvent- Returns:
- the value of the
timestamprecord component
-
component
Returns the value of thecomponentrecord component.- Returns:
- the value of the
componentrecord component
-
operation
Returns the value of theoperationrecord component.- Returns:
- the value of the
operationrecord component
-
index
public int index()Returns the value of theindexrecord component.- Returns:
- the value of the
indexrecord component
-
oldValue
Returns the value of theoldValuerecord component.- Returns:
- the value of the
oldValuerecord component
-
newValue
Returns the value of thenewValuerecord component.- Returns:
- the value of the
newValuerecord component
-