Magentix2  2.1.1
es.upv.dsic.gti_ia.core.ACLMessage Class Reference
Inheritance diagram for es.upv.dsic.gti_ia.core.ACLMessage:
Collaboration diagram for es.upv.dsic.gti_ia.core.ACLMessage:

List of all members.

Public Member Functions

 ACLMessage ()
 ACLMessage (int performative)
void setPerformative (int performative)
String getPerformative ()
int getPerformativeInt ()
void setSender (AgentID sender)
AgentID getSender ()
void setReceiver (AgentID receiver)
AgentID getReceiver ()
AgentID getReceiver (int index)
void setReplyTo (AgentID reply)
AgentID getReplyTo ()
void setContent (String cont)
String getContent ()
void setLanguage (String lang)
String getLanguage ()
void setEncoding (String encoding)
String getEncoding ()
void setOntology (String ontology)
String getOntology ()
void setProtocol (String protocol)
String getProtocol ()
void setConversationId (String id)
String getConversationId ()
void setReplyWith (String rw)
String getReplyWith ()
void setInReplyTo (String irt)
String getInReplyTo ()
void setReplyByDate (Date date)
Date getReplyByDate ()
String getReplyBy ()
void setPerformative (String performative)
void clearAllReceiver ()
int addReceiver (AgentID r)
ArrayList< AgentIDgetReceiverList ()
int getTotalReceivers ()
synchronized ACLMessage clone ()
ACLMessage createReply ()
void copyFromAsTemplate (ACLMessage msg)
void setHeader (String key, String value)
String getHeaderValue (String key)
Map< String, String > getHeaders ()
void setContentObject (java.io.Serializable s) throws IOException
void setByteSequenceContent (byte[] content)
byte[] getByteSequenceContent ()
Object getContentObject ()
String toString ()
Map< String, String > getExchangeHeaders ()
void putExchangeHeader (String key, String value)
String getExchangeHeader (String key)
boolean equals (Object obj)

Static Public Member Functions

static int getPerformative (String perf)
static String getPerformative (int perf)
static ACLMessage fromString (String strMsg)

Static Public Attributes

static final int ACCEPT_PROPOSAL = 0
static final int AGREE = 1
static final int CANCEL = 2
static final int CFP = 3
static final int CONFIRM = 4
static final int DISCONFIRM = 5
static final int FAILURE = 6
static final int INFORM = 7
static final int INFORM_IF = 8
static final int INFORM_REF = 9
static final int NOT_UNDERSTOOD = 10
static final int PROPOSE = 11
static final int QUERY_IF = 12
static final int QUERY_REF = 13
static final int REFUSE = 14
static final int REJECT_PROPOSAL = 15
static final int REQUEST = 16
static final int REQUEST_WHEN = 17
static final int REQUEST_WHENEVER = 18
static final int SUBSCRIBE = 19
static final int PROXY = 20
static final int PROPAGATE = 21
static final int UNKNOWN = -1

Static Package Functions

 [static initializer]

Detailed Description

This class represents a message sent between agents.

Author:
Ricard Lopez Fogues
Luis Burdalo (Added toString and fromString methods)

Definition at line 27 of file ACLMessage.java.


Constructor & Destructor Documentation

Empty constructor. The performative is set to UNKNOWN

See also:
setPerformative

Definition at line 181 of file ACLMessage.java.

                            {
                performative = UNKNOWN;
                conversation_id = UUID.randomUUID().toString();
        }

Constructor for the class. Only sets the performative.

Parameters:
performativeThe performative to be used in this message.
See also:
setPerformative

Definition at line 191 of file ACLMessage.java.

                                            {
                this.performative = performative;
                conversation_id = UUID.randomUUID().toString();
        }

Member Function Documentation

es.upv.dsic.gti_ia.core.ACLMessage.[static initializer] ( ) [static, package]

Adds a receiver to the receivers list

Parameters:
receiverAgentID of the receiver to be added.
Returns:
-1 if the agent already exists in the list, 1 otherwise

Definition at line 516 of file ACLMessage.java.

                                          {
                // Test if the agent exists, if it exists return -1
                for (int i = 0; i < receiver.size(); i++) {
                        if (receiver.get(i).name.equals(r.name)
                                        && receiver.get(i).host.equals(r.host)
                                        && receiver.get(i).port.equals(r.port)
                                        && receiver.get(i).protocol.equals(r.protocol)) {
                                return -1;
                        }
                }
                receiver.add(r);
                return 1;
        }

Clears receivers list

Definition at line 506 of file ACLMessage.java.

                                       {
                this.receiver.clear();
        }

Clones Message

Returns:
Another ACLMessage that is a clone from this one

Definition at line 553 of file ACLMessage.java.

                                               {
                ACLMessage result;

                try {
                        result = (ACLMessage) super.clone();

                } catch (CloneNotSupportedException cnse) {
                        throw new InternalError(); // This should never happen
                }

                return result;
        }

Copies the fields of the message to this one, when those fields have a correct value. If they don't, they are not copied.

Parameters:
msgFrom which the fields are to be copied.

Definition at line 600 of file ACLMessage.java.

                                                       {                

                if (msg.getPerformativeInt() != ACLMessage.UNKNOWN) {
                        this.setPerformative(msg.getPerformativeInt());
                }
                
                this.setSender(msg.getSender());
                
                if (msg.getReceiverList() != null){
                        for(int i = 0; i<msg.getReceiverList().size();i++)
                                this.addReceiver(msg.getReceiver(i));
                }
                
                this.setReplyTo(msg.getReplyTo());
                
                if (msg.getContent() != null) {
                        this.setContent(msg.getContent());
                }
                
                this.setLanguage(msg.getLanguage());
                
                this.setEncoding(msg.getEncoding());
                
                if (msg.getOntology() != null) {
                        this.setOntology(msg.getOntology());
                }
                
                if (msg.getProtocol() != null) {
                        this.setProtocol(msg.getProtocol());
                }
                
                if (msg.getConversationId() != null) {
                        this.setConversationId(msg.getConversationId());
                }
                
                this.setReplyWith(msg.getReplyWith());
                
                this.setInReplyTo(msg.getInReplyTo());
                
                this.setReplyByDate(msg.getReplyByDate());
                
                Iterator<Entry<String, String>> it = this.headers.entrySet().iterator();
                while (it.hasNext()) {
                        Map.Entry<String, String> pairs = (Map.Entry<String, String>)it.next();
                        this.setHeader(String.valueOf(pairs.getKey()), String.valueOf(pairs.getValue()));
                }               
                
                Map<String,String> headers = msg.getExchangeHeaders();
                
                for (String key : headers.keySet())
                {
                        this.putExchangeHeader(key, headers.get(key));
                }
        }

Creates an ACLMessage that is a reply to this one

Returns:
ACLMessage that is a reply to this one

Definition at line 571 of file ACLMessage.java.

                                        {
                ACLMessage m = (ACLMessage) clone();

                m.clearAllReceiver();

                m.setReceiver(getSender());
                m.setLanguage(getLanguage());
                m.setOntology(getOntology());
                m.setProtocol(getProtocol());
                m.setSender(null);
                m.setInReplyTo(getReplyWith());
                m.setConversationId(getConversationId());
                m.setReplyByDate(null);
                m.setContent("");
                m.setEncoding("");
                m.exchangeHeaders = new HashMap<String, String>();
                // #CUSTOM_EXCLUDE_BEGIN
                // Set the Aclrepresentation of the reply message to the
                // aclrepresentation of the sent message

                // #CUSTOM_EXCLUDE_END
                return m;
        }

Compares two ACLMessages

Parameters:
MessageThe message to compare with
Returns:
True if messages are equal, false if not

Definition at line 1053 of file ACLMessage.java.

        {
                if ( obj == null ) return false;
            if ( this == obj ) return true;
            if ( ! (obj instanceof ACLMessage ) ) return false;
            ACLMessage mc = (ACLMessage) obj;
            if(!this.getPerformative().equals(mc.getPerformative())) return false;          
            if(!this.getSender().toString().equals(mc.getSender().toString())) return false;
            if(!this.getReplyTo().toString().equals(mc.getReplyTo().toString())) return false;
            if(!this.getLanguage().equals(mc.getLanguage())) return false;
            if(!this.getEncoding().equals(mc.getEncoding())) return false;
            if(!this.getOntology().equals(mc.getOntology())) return false;
            if(!this.getProtocol().equals(mc.getProtocol())) return false;
            if(!this.getConversationId().equals(mc.getConversationId())) return false;
            if(!this.getReplyWith().equals(mc.getReplyWith())) return false;
            if(!this.getReplyBy().equals(mc.getReplyBy())) return false;
            if(!this.getInReplyTo().equals(mc.getInReplyTo())) return false;        
            if(this.getReplyByDate() == null && mc.getReplyByDate() == null){
                //Messages are equal
            }else{
                if(!this.getReplyByDate().equals(mc.getReplyByDate())) return false;
            }       
            
            //Compare byteSequenceContent, receivers, headers and exchangeHeaders
            //ByteSequence arrays should be totally equals (even in the order)
            byte [] msgBytes = this.getByteSequenceContent();           
                byte [] mcBytes = mc.getByteSequenceContent();
                if(msgBytes.length != mcBytes.length)//check different length
                        return false;
                for(int i = 0; i<mcBytes.length; i++)//check different content
                        if(mcBytes[i] != msgBytes[i])
                                return false;
                
                //Receivers and headers should be equal but not necessary in order
                //use of set for efficiency
            Set<AgentID> setReceivers = new HashSet<AgentID>(this.getReceiverList());
            Set<AgentID> setReceiversMc = new HashSet<AgentID>(mc.getReceiverList());
            if(!setReceivers.equals(setReceiversMc)) return false;
            Set<Map.Entry<String,String>> setHeaders = this.getHeaders().entrySet();
            Set<Map.Entry<String,String>> setHeadersMc = mc.getHeaders().entrySet();
            if(!setHeaders.equals(setHeadersMc)) return false;
            Set<Map.Entry<String,String>> setExchangeHeaders = this.getExchangeHeaders().entrySet();
            Set<Map.Entry<String,String>> setExchangeHeadersMc = mc.getExchangeHeaders().entrySet();
            if(!setExchangeHeaders.equals(setExchangeHeadersMc)) return false;
            
            return true;            
        }
static ACLMessage es.upv.dsic.gti_ia.core.ACLMessage.fromString ( String  strMsg) [static]

Parses the message given as a String and creates an object of type ACLMessage.

Parameters:
strMsgString containing a serialization of an ACLMessage
Returns:
An object of type ACLMessage created from the given String
See also:
ACLMessage::toString()

Definition at line 903 of file ACLMessage.java.

                                                           {
                // Unserialize message content
                ACLMessage msg;
                int indice1 = 0;
                int indice2 = 0;
                int aidindice1 = 0;
                int aidindice2 = 0;
                int tam = 0;
                String aidString;
                
                indice2 = strMsg.indexOf('#', indice1);
                msg = new ACLMessage(Integer.parseInt(strMsg.substring(indice1, indice2)));
                
                // Unserialize different AgentID's (Sender, Receiver, ReplyTo)
                for (int i = 0; i < 3; i++)
                {
                        AgentID aid = new AgentID();
                        aidindice1 = 0;
                        aidindice2 = 0;
                        indice1 = indice2 + 1 + tam;
                        indice2 = strMsg.indexOf('#', indice1);
                        tam = Integer.parseInt(strMsg.substring(indice1, indice2));
                        aidString = strMsg.substring(indice2 + 1, indice2 + 1 + tam);
                        aidindice2 = aidString.indexOf(':');
                        if (aidindice2 - aidindice1 <= 0)
                                aid.protocol = "";
                        else
                                aid.protocol = aidString.substring(aidindice1, aidindice2);
                        aidindice1 = aidindice2 + 3;
                        aidindice2 = aidString.indexOf('@', aidindice1);
                        if (aidindice2 - aidindice1 <= 0)
                                aid.name = "";
                        else
                                aid.name = aidString.substring(aidindice1, aidindice2);
                        aidindice1 = aidindice2 + 1;
                        aidindice2 = aidString.indexOf(':', aidindice1);
                        if (aidindice2 - aidindice1 <= 0)
                                aid.host = "";
                        else
                                aid.host = aidString.substring(aidindice1, aidindice2);
                        aid.port = aidString.substring(aidindice2 + 1);
                        
                        if (i == 0)
                                msg.setSender(aid);
                        if (i == 1)
                                if(aid.protocol.equals("") && aid.name.equals("") && aid.host.equals(""))
                                        msg.clearAllReceiver(); //let receivers empty
                                else
                                        msg.setReceiver(aid);                                   
                        if (i == 2)
                                msg.setReplyTo(aid);
                                
                }
                indice1 = indice2 + 1 + tam;
                indice2 = strMsg.indexOf('#', indice1);
                tam = Integer.parseInt(strMsg.substring(indice1, indice2));
                // language
                msg.setLanguage(strMsg.substring(indice2 + 1, indice2 + 1 + tam));
                
                indice1 = indice2 + 1 + tam;
                indice2 = strMsg.indexOf('#', indice1);
                tam = Integer.parseInt(strMsg.substring(indice1, indice2));
                // encoding
                msg.setEncoding(strMsg.substring(indice2 + 1, indice2 + 1 + tam));
                
                indice1 = indice2 + 1 + tam;
                indice2 = strMsg.indexOf('#', indice1);
                tam = Integer.parseInt(strMsg.substring(indice1, indice2));
                // ontologyencodingACLMessage template
                msg.setOntology(strMsg.substring(indice2 + 1, indice2 + 1 + tam));
                
                indice1 = indice2 + 1 + tam;
                indice2 = strMsg.indexOf('#', indice1);
                tam = Integer.parseInt(strMsg.substring(indice1, indice2));
                // Protocol
                msg.setProtocol(strMsg.substring(indice2 + 1, indice2 + 1 + tam));
                
                indice1 = indice2 + 1 + tam;
                indice2 = strMsg.indexOf('#', indice1);
                tam = Integer.parseInt(strMsg.substring(indice1, indice2));
                // Conversation id
                msg.setConversationId(strMsg.substring(indice2 + 1, indice2 + 1 + tam));
                
                indice1 = indice2 + 1 + tam;
                indice2 = strMsg.indexOf('#', indice1);
                tam = Integer.parseInt(strMsg.substring(indice1, indice2));
                // Reply with
                msg.setReplyWith(strMsg.substring(indice2 + 1, indice2 + 1 + tam));
                
                indice1 = indice2 + 1 + tam;
                indice2 = strMsg.indexOf("#", indice1);
                
                tam = Integer.parseInt(strMsg.substring(indice1, indice2));
                // In reply to
                msg.setInReplyTo(strMsg.substring(indice2 + 1, indice2 + 1 + tam));
                
                indice1 = indice2 + 1 + tam;
                indice2 = strMsg.indexOf('#', indice1);
                tam = Integer.parseInt(strMsg.substring(indice1, indice2));
                // reply by
                
                if (tam != 0)
                        msg.setReplyByDate(new Date(Integer.parseInt(strMsg.substring(indice2 + 10, indice2 + tam))));
                
                indice1 = indice2 + 1 + tam;
                indice2 = strMsg.indexOf('#', indice1);
                tam = Integer.parseInt(strMsg.substring(indice1, indice2));
                // Content
                msg.setContent(strMsg.substring(indice2 + 1, indice2 + 1 + tam));
                
                return msg;
        }

Reads :content slot.

Returns:
The value of :content slot.

Definition at line 752 of file ACLMessage.java.

                                               {
                if (content != null) {
                        return new StringBuffer(content).toString().getBytes();
                }
                else if (byteSequenceContent != null)
                        return byteSequenceContent;
                return null;
        }

Gets the content of this message.

Returns:
Content of content field as a String .property name="content"

Definition at line 318 of file ACLMessage.java.

                                   {
                return content;
        }

This method returns the content of this ACLMessage when they have been written via the method setContentObject.

Returns:
the object read from the content of this ACLMessage

Definition at line 768 of file ACLMessage.java.

                                         {
                
                Object o = null;
                if(content != null && !content.equals(""))
                        return (Object)content;
                else if(this.byteSequenceContent != null){
                        try{
                                byte[] data = getByteSequenceContent();
                                if (data == null)
                                        return null;
                                ByteArrayInputStream bis = new ByteArrayInputStream(data);
                                ObjectInputStream oin = new ObjectInputStream(bis);
                                o = (java.io.Serializable)oin.readObject();
                                return o;
                        }
                        catch (java.lang.Error e) {
                                e.printStackTrace();
                        }
                        catch (IOException e1) {
                                e1.printStackTrace();
                        }
                        catch(ClassNotFoundException e2) {
                                e2.printStackTrace();
                        }
                }
                return o;
        }

Gets the conversationID of this message.

Returns:
conversation id

Definition at line 415 of file ACLMessage.java.

                                          {
                return conversation_id;
        }

Get the encoding for this message.

Returns:
encoding .property name="encoding"

Definition at line 357 of file ACLMessage.java.

                                    {
                return encoding;
        }

Gets the value of a exchange header for this message.

Parameters:
keyThe name of the exchange header
Returns:
The value of the exchange header specified

Definition at line 1042 of file ACLMessage.java.

                                                   {
                return this.exchangeHeaders.get(key);
        }

Obtains the whole set of exchange headers in this message.

Returns:
A Map containing all the exchange headers (and its contents) in this message

Definition at line 1021 of file ACLMessage.java.

        {
                return this.exchangeHeaders;
        }

Obtains the whole set of headers in this message.

Returns:
A Map containing all the headers (and its contents) in this message

Definition at line 683 of file ACLMessage.java.

                                                {
                return headers;
        }

Gets the value of a header for this message.

Parameters:
keyThe name of the header
Returns:
The value of the header specified

Definition at line 671 of file ACLMessage.java.

                                                 {
                if (headers.get(key) != null)
                        return headers.get(key);
                else
                        return "";
        }

Gets the inReplyTo field of this message.

Returns:
in reply to

Definition at line 451 of file ACLMessage.java.

                                     {
                return in_reply_to;
        }

Gets the language field.

Returns:
content of language field .property name="language"

Definition at line 338 of file ACLMessage.java.

                                    {
                return language;
        }

Get the ontology for the message

Returns:
ontology .property name="ontology"

Definition at line 377 of file ACLMessage.java.

                                    {
                return ontology;
        }
Returns:
Performative type as a String .property name="performative"

Definition at line 210 of file ACLMessage.java.

                                        {
                try {
                        if(performative == -1) return "UNKNOWN";
                        return performatives[performative];
                } catch (Exception e) {
                        return performatives[NOT_UNDERSTOOD];
                }
        }
static int es.upv.dsic.gti_ia.core.ACLMessage.getPerformative ( String  perf) [static]

Returns the integer corresponding to the performative

Returns:
the integer corresponding to the performative; -1 otherwise

Definition at line 726 of file ACLMessage.java.

        {
                String tmp = perf.toUpperCase();
                for (int i=0; i<performatives.length; i++)
                        if (performatives[i].equals(tmp))
                                return i;
                return -1;
        }
static String es.upv.dsic.gti_ia.core.ACLMessage.getPerformative ( int  perf) [static]

Returns the string corresponding to the integer for the performative

Returns:
the string corresponding to the integer for the performative; "NOT-UNDERSTOOD" if the integer is out of range.

Definition at line 740 of file ACLMessage.java.

                                                      {
                try {
                        return performatives[perf];
                } catch (Exception e) {
                        return performatives[NOT_UNDERSTOOD];
                }
        }
Returns:
Performative type as an integer

Definition at line 223 of file ACLMessage.java.

                                        {
                return performative;
        }

Gets the protocol for the message

Returns:
protocol .property name="protocol"

Definition at line 397 of file ACLMessage.java.

                                    {
                return protocol;
        }

Obtains the AgentID of the first receiver of the (possibly many) receivers of this message.

Returns:
First receiver in receivers list .property name="receiver"
See also:
AgentID

Definition at line 265 of file ACLMessage.java.

                                     {
                if (receiver.isEmpty()) {
                        return null;
                } else {
                        return receiver.get(0);
                }
        }

Returns receiver in index position in receivers list

Parameters:
index
Returns:
receiver

Definition at line 279 of file ACLMessage.java.

                                              {
                return receiver.get(index);
        }

Returns the whole list of the AgentID of the receivers.

Returns:
receivers list
See also:
AgentID

Definition at line 535 of file ACLMessage.java.

                                                    {
                return receiver;
        }

Gets the replyBy field.

Returns:
reply by time in string format

Definition at line 480 of file ACLMessage.java.

                                   {
                if (reply_byInMillisec != 0)
                        return ISO8601.toString(new Date(reply_byInMillisec));
                else
                        return "";
        }

Gets the replyByDate field for this message.

Returns:
reply by time in date format

Definition at line 468 of file ACLMessage.java.

                                     {
                if (reply_byInMillisec != 0)
                        return new Date(reply_byInMillisec);
                else
                        return null;
        }

Gets the ReplyTo field

Returns:
AgentID of ReplyTo field

Definition at line 297 of file ACLMessage.java.

                                    {
                return reply_to;
        }

Gets the replyWith field of this message.

Returns:
reply with

Definition at line 433 of file ACLMessage.java.

                                     {
                return reply_with;
        }

Returns the sender of this message.

Returns:
sender The AgentID of the sender of this message. .property name="sender"
See also:
AgentID

Definition at line 244 of file ACLMessage.java.

                                   {
                return sender;
        }

Gets the count of receivers of this message.

Returns:
total number of receivers

Definition at line 544 of file ACLMessage.java.

                                       {
                return receiver.size();
        }
void es.upv.dsic.gti_ia.core.ACLMessage.putExchangeHeader ( String  key,
String  value 
)

Adds the value of a exchange header for this message.

Parameters:
keyThe name of the exchange header
valueThe content for the exchange header

Definition at line 1032 of file ACLMessage.java.

                                                               {
                this.exchangeHeaders.put(key, value);
        }

Sets the value of byte sequence content

Parameters:
bytearray to store

Definition at line 717 of file ACLMessage.java.

                                                           {
                this.content = null; //make to null the other variable
                byteSequenceContent = content;
        }

Sets content field.

Parameters:
cont.property name="content"

Definition at line 307 of file ACLMessage.java.

                                            {
                byteSequenceContent = null; //make to null the other variable
                content = cont;
        }
void es.upv.dsic.gti_ia.core.ACLMessage.setContentObject ( java.io.Serializable  s) throws IOException

Sets the value of byte sequence content

Parameters:
serializableobject to store

Definition at line 704 of file ACLMessage.java.

        {
                ByteArrayOutputStream c = new ByteArrayOutputStream();
                ObjectOutputStream oos = new ObjectOutputStream(c);
                oos.writeObject(s);
                oos.flush();
                setByteSequenceContent(c.toByteArray());
        }

Sets the conversationID of this message.

Parameters:
idA String containing the conversationID to be set.

Definition at line 406 of file ACLMessage.java.

                                                 {
                conversation_id = id;
        }

Set encoding of the message

Parameters:
encoding.property name="encoding"

Definition at line 348 of file ACLMessage.java.

                                                 {
                this.encoding = encoding;
        }
void es.upv.dsic.gti_ia.core.ACLMessage.setHeader ( String  key,
String  value 
)

Sets the value of a header for this message.

Parameters:
keyThe name of the header
valueThe content for the header

Definition at line 661 of file ACLMessage.java.

                                                        {
                headers.put(key, value);
        }

Sets the inReplyTo field of this message.

Parameters:
inReplyTo

Definition at line 442 of file ACLMessage.java.

                                             {
                in_reply_to = irt;
        }

Sets language field

Parameters:
lang.property name="language"

Definition at line 328 of file ACLMessage.java.

                                             {
                language = lang;
        }

Set ontology of the message

Parameters:
ontology.property name="ontology"

Definition at line 367 of file ACLMessage.java.

                                                 {
                this.ontology = ontology;
        }

Sets performative type

Parameters:
performative.property name="performative"

Definition at line 202 of file ACLMessage.java.

                                                      {
                this.performative = performative;
        }

Sets the performative field in the message.

Parameters:
performativeMust contain a valid performative (e.g. INFORM) in order to be set. See the performatives in this class to notice which ones are valid.
See also:
ACLMessage

Definition at line 494 of file ACLMessage.java.

                                                         {
                for (int i = 0; i < performatives.length; i++) {
                        if (performative.compareTo(performatives[i]) == 0) {
                                this.performative = i;
                                break;
                        }
                }
        }

Sets the protocol for the message

Parameters:
protocol.property name="protocol"

Definition at line 387 of file ACLMessage.java.

                                                 {
                this.protocol = protocol;
        }

Sets the receiver. It deletes the receivers list and creates a new one with the new receiver

Parameters:
receiver

Definition at line 254 of file ACLMessage.java.

                                                  {
                this.receiver.clear();
                this.receiver.add(receiver);
        }

Sets the replyByDate field for this message.

Parameters:
dateIf the date is null, the current time and date is used.

Definition at line 460 of file ACLMessage.java.

                                              {
                reply_byInMillisec = (date == null ? 0 : date.getTime());
        }

Sets ReplyTo field

Parameters:
reply

Definition at line 288 of file ACLMessage.java.

                                              {
                reply_to = reply;
        }

Sets the replyWith field of this message.

Parameters:
replyWith

Definition at line 424 of file ACLMessage.java.

                                            {
                reply_with = rw;
        }

Set sender

Parameters:
senderThe AgentID of the sender of this message. .property name="sender"
See also:
AgentID

Definition at line 234 of file ACLMessage.java.

                                              {
                this.sender = sender;
        }

Serializes this message to a String, using all the fields in the message. The fields are separated using the char '#'

Definition at line 800 of file ACLMessage.java.

                                {
                // Serialize message content
                String strMsg;
                
                // Performative
                strMsg = this.getPerformativeInt() + "#";
                // Sender
                if (this.getSender() == null){
                        strMsg = strMsg + "0#";
                }
                else{
                        strMsg = strMsg + this.getSender().toString().length() + "#"
                                                + this.getSender().toString();
                }
                // receiver
                if (this.getReceiver() == null){
                        strMsg = strMsg + "0#";
                }
                else{
                        strMsg = strMsg + this.getReceiver().toString().length() + "#"
                                                + this.getReceiver().toString();
                }
                // reply to
                if (this.getReplyTo() == null){
                        strMsg = strMsg + "0#";
                }
                else{
                        strMsg = strMsg + this.getReplyTo().toString().length() + "#"
                                                + this.getReplyTo().toString();
                }
                // language
                if (this.getLanguage() == null){
                        strMsg = strMsg + "0#";
                }
                else{
                        strMsg = strMsg + this.getLanguage().length() + "#" + this.getLanguage();
                }
                // encoding
                if (this.getEncoding() == null){
                        strMsg = strMsg + "0#";
                }
                else{
                        strMsg = strMsg + this.getEncoding().length() + "#" + this.getEncoding();
                }
                // ontology
                if (this.getOntology() == null){
                        strMsg = strMsg + "0#";
                }
                else{
                        strMsg = strMsg + this.getOntology().length() + "#" + this.getOntology();
                }
                // protocol
                if (this.getProtocol() == null){
                        strMsg = strMsg + "0#";
                }
                else{
                        strMsg = strMsg + this.getProtocol().length() + "#" + this.getProtocol();
                }
                // conversation id
                if (this.getConversationId() == null){
                        strMsg = strMsg + "0#";
                }
                else{
                        strMsg = strMsg + this.getConversationId().length() + "#"
                                                + this.getConversationId();
                }
                // reply with
                if (this.getReplyWith() == null){
                        strMsg = strMsg + "0#";
                }
                else{
                        strMsg = strMsg + this.getReplyWith().length() + "#" + this.getReplyWith();
                }
                // in reply to
                if (this.getInReplyTo() == null){
                        strMsg = strMsg + "0#";
                }
                else{
                        strMsg = strMsg + this.getInReplyTo().length() + "#" + this.getInReplyTo();
                }
                // reply by
                strMsg = strMsg + this.getReplyBy().length() + "#" + this.getReplyBy();
                
                // content
                if (this.getContent() == null){
                        strMsg = strMsg + "0#";
                }
                else{
                        strMsg = strMsg + this.getContent().length() + "#" + this.getContent();
                }
                
                return strMsg;
        }

Member Data Documentation

constant identifying the FIPA performative

Definition at line 35 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 37 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 39 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 41 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 43 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 45 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 47 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 49 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 51 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 53 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 55 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 77 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 57 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 75 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 59 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 61 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 63 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 65 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 67 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 69 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 71 of file ACLMessage.java.

constant identifying the FIPA performative

Definition at line 73 of file ACLMessage.java.

constant identifying an unknown performative

Definition at line 79 of file ACLMessage.java.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables