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:
  • 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 a FIPAMessage record class.
      Parameters:
      id - the value for the id record component
      performative - the value for the performative record component
      sender - the value for the sender record component
      receiver - the value for the receiver record component
      content - the value for the content record component
      conversationId - the value for the conversationId record component
      replyWith - the value for the replyWith record component
      inReplyTo - the value for the inReplyTo record component
      protocol - the value for the protocol record component
      language - the value for the language record component
      encoding - the value for the encoding record component
      ontology - the value for the ontology record component
      timestamp - the value for the timestamp record component
      replyBy - the value for the replyBy record component
      userParameters - the value for the userParameters record component
  • Method Details

    • builder

      public static FIPAMessage.Builder builder()
      Creates a new message builder.
      Returns:
      builder
    • createReply

      public FIPAMessage.Builder createReply()
      Creates a reply builder to this message.
      Returns:
      builder pre-configured for reply
    • inform

      public static FIPAMessage inform(String sender, String receiver, String content)
      Creates an INFORM message.
      Parameters:
      sender - sender ID
      receiver - receiver ID
      content - message content
      Returns:
      inform message
    • request

      public static FIPAMessage request(String sender, String receiver, String content)
      Creates a REQUEST message.
      Parameters:
      sender - sender ID
      receiver - receiver ID
      content - request content
      Returns:
      request message
    • queryIf

      public static FIPAMessage queryIf(String sender, String receiver, String proposition)
      Creates a QUERY_IF message.
      Parameters:
      sender - sender ID
      receiver - receiver ID
      proposition - proposition to query
      Returns:
      query message
    • cfp

      public static FIPAMessage cfp(String sender, String receiver, String taskDescription)
      Creates a CFP (Call for Proposals) message.
      Parameters:
      sender - sender ID
      receiver - receiver ID
      taskDescription - 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

      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.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • performative

      public FIPAPerformative performative()
      Returns the value of the performative record component.
      Returns:
      the value of the performative record component
    • sender

      public String sender()
      Returns the value of the sender record component.
      Returns:
      the value of the sender record component
    • receiver

      public String receiver()
      Returns the value of the receiver record component.
      Returns:
      the value of the receiver record component
    • content

      public String content()
      Returns the value of the content record component.
      Returns:
      the value of the content record component
    • conversationId

      public String conversationId()
      Returns the value of the conversationId record component.
      Returns:
      the value of the conversationId record component
    • replyWith

      public String replyWith()
      Returns the value of the replyWith record component.
      Returns:
      the value of the replyWith record component
    • inReplyTo

      public String inReplyTo()
      Returns the value of the inReplyTo record component.
      Returns:
      the value of the inReplyTo record component
    • protocol

      public String protocol()
      Returns the value of the protocol record component.
      Returns:
      the value of the protocol record component
    • language

      public String language()
      Returns the value of the language record component.
      Returns:
      the value of the language record component
    • encoding

      public String encoding()
      Returns the value of the encoding record component.
      Returns:
      the value of the encoding record component
    • ontology

      public String ontology()
      Returns the value of the ontology record component.
      Returns:
      the value of the ontology record component
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • replyBy

      public Instant replyBy()
      Returns the value of the replyBy record component.
      Returns:
      the value of the replyBy record component
    • userParameters

      public Map<String,Object> userParameters()
      Returns the value of the userParameters record component.
      Returns:
      the value of the userParameters record component