Package com.tnsai.protocols.fipa
Record Class FIPAMessage
java.lang.Object
java.lang.Record
com.tnsai.protocols.fipa.FIPAMessage
public record FIPAMessage(String id, FIPAPerformative performative, String sender, String receiver, String content, String conversationId, String replyWith, String inReplyTo, String protocol, String language, String encoding, String ontology, Instant timestamp, Instant replyBy, Map<String,Object> userParameters)
extends Record
FIPA ACL Message.
Represents a message conforming to FIPA Agent Communication Language specification. Contains performative, content, and conversation management parameters.
Message Parameters
- performative - Communication intent (required)
- sender - Agent identifier of sender
- receiver - Agent identifier(s) of receiver(s)
- content - Message content
- conversationId - Groups related messages
- replyWith - Expression for reply identification
- inReplyTo - References previous message
- protocol - Interaction protocol name
Usage Example
FIPAMessage request = FIPAMessage.builder()
.performative(FIPAPerformative.REQUEST)
.sender("agent-1")
.receiver("agent-2")
.content("Please perform analysis")
.protocol("fipa-request")
.build();
FIPAMessage reply = request.createReply()
.performative(FIPAPerformative.AGREE)
.content("I will perform the analysis")
.build();
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionFIPAMessage(String id, FIPAPerformative performative, String sender, String receiver, String content, String conversationId, String replyWith, String inReplyTo, String protocol, String language, String encoding, String ontology, Instant timestamp, Instant replyBy, Map<String, Object> userParameters) Creates an instance of aFIPAMessagerecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic FIPAMessage.Builderbuilder()Creates a new message builder.static FIPAMessageCreates a CFP (Call for Proposals) message.content()Returns the value of thecontentrecord component.Returns the value of theconversationIdrecord component.Creates a reply builder to this message.encoding()Returns the value of theencodingrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanChecks if this message expects a reply.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.static FIPAMessageCreates an INFORM message.Returns the value of theinReplyTorecord component.booleanisReply()Checks if this is a reply to another message.booleanChecks if reply deadline has passed.language()Returns the value of thelanguagerecord component.ontology()Returns the value of theontologyrecord component.Returns the value of theperformativerecord component.protocol()Returns the value of theprotocolrecord component.static FIPAMessageCreates a QUERY_IF message.receiver()Returns the value of thereceiverrecord component.replyBy()Returns the value of thereplyByrecord component.Returns the value of thereplyWithrecord component.static FIPAMessageCreates a REQUEST message.sender()Returns the value of thesenderrecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.Returns the value of theuserParametersrecord component.
-
Constructor Details
-
FIPAMessage
public FIPAMessage(String id, FIPAPerformative performative, String sender, String receiver, String content, String conversationId, String replyWith, String inReplyTo, String protocol, String language, String encoding, String ontology, Instant timestamp, Instant replyBy, Map<String, Object> userParameters) Creates an instance of aFIPAMessagerecord class.- Parameters:
id- the value for theidrecord componentperformative- the value for theperformativerecord componentsender- the value for thesenderrecord componentreceiver- the value for thereceiverrecord componentcontent- the value for thecontentrecord componentconversationId- the value for theconversationIdrecord componentreplyWith- the value for thereplyWithrecord componentinReplyTo- the value for theinReplyTorecord componentprotocol- the value for theprotocolrecord componentlanguage- the value for thelanguagerecord componentencoding- the value for theencodingrecord componentontology- the value for theontologyrecord componenttimestamp- the value for thetimestamprecord componentreplyBy- the value for thereplyByrecord componentuserParameters- the value for theuserParametersrecord component
-
-
Method Details
-
builder
Creates a new message builder.- Returns:
- builder
-
createReply
Creates a reply builder to this message.- Returns:
- builder pre-configured for reply
-
inform
Creates an INFORM message.- Parameters:
sender- sender IDreceiver- receiver IDcontent- message content- Returns:
- inform message
-
request
Creates a REQUEST message.- Parameters:
sender- sender IDreceiver- receiver IDcontent- request content- Returns:
- request message
-
queryIf
Creates a QUERY_IF message.- Parameters:
sender- sender IDreceiver- receiver IDproposition- proposition to query- Returns:
- query message
-
cfp
Creates a CFP (Call for Proposals) message.- Parameters:
sender- sender IDreceiver- receiver IDtaskDescription- task to bid on- Returns:
- CFP message
-
expectsReply
public boolean expectsReply()Checks if this message expects a reply.- Returns:
- true if reply expected
-
isReply
public boolean isReply()Checks if this is a reply to another message.- Returns:
- true if is reply
-
isReplyOverdue
public boolean isReplyOverdue()Checks if reply deadline has passed.- Returns:
- true if deadline passed
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
performative
Returns the value of theperformativerecord component.- Returns:
- the value of the
performativerecord component
-
sender
Returns the value of thesenderrecord component.- Returns:
- the value of the
senderrecord component
-
receiver
Returns the value of thereceiverrecord component.- Returns:
- the value of the
receiverrecord component
-
content
Returns the value of thecontentrecord component.- Returns:
- the value of the
contentrecord component
-
conversationId
Returns the value of theconversationIdrecord component.- Returns:
- the value of the
conversationIdrecord component
-
replyWith
Returns the value of thereplyWithrecord component.- Returns:
- the value of the
replyWithrecord component
-
inReplyTo
Returns the value of theinReplyTorecord component.- Returns:
- the value of the
inReplyTorecord component
-
protocol
Returns the value of theprotocolrecord component.- Returns:
- the value of the
protocolrecord component
-
language
Returns the value of thelanguagerecord component.- Returns:
- the value of the
languagerecord component
-
encoding
Returns the value of theencodingrecord component.- Returns:
- the value of the
encodingrecord component
-
ontology
Returns the value of theontologyrecord component.- Returns:
- the value of the
ontologyrecord component
-
timestamp
Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-
replyBy
Returns the value of thereplyByrecord component.- Returns:
- the value of the
replyByrecord component
-
userParameters
Returns the value of theuserParametersrecord component.- Returns:
- the value of the
userParametersrecord component
-