utilities
Class KQMLMessage

java.lang.Object
  |
  +--utilities.Message
        |
        +--utilities.KQMLMessage
All Implemented Interfaces:
java.lang.Cloneable

public class KQMLMessage
extends Message
implements java.lang.Cloneable

This class is essentially a wrapper for the KQMLLayer message class


Constructor Summary
KQMLMessage(java.lang.Object c, java.lang.String da)
          A "tell" message
KQMLMessage(java.lang.String s)
          Send in your encoded message to decode it
KQMLMessage(java.lang.String p, java.lang.Object c, java.lang.String da)
          Normal constructor
KQMLMessage(java.lang.String p, java.lang.Object c, java.lang.String da, int po)
          Normal constructor
 
Method Summary
 void addField(java.lang.String fn, java.lang.String fc)
          Adds a field/ value pair to the message
 java.lang.Object clone()
          Clone
 java.lang.String contentData()
          Returns the data in the content (the stuff after the first word in the content), cleaning the KQML stuff off first
 java.lang.String contentWord()
          Returns the first word in the content (used to determine the type of content), cleaning the KQML stuff off first
 java.lang.String getField(java.lang.String fn)
          Get a field/ value pair to the message
 java.lang.String getPerformative()
          Performative accessors
 void removeField(java.lang.String fn)
          Removes a field/ value pair from the message
 void setContent(java.lang.Object c)
          Sets the message's content string
 void setDestAddr(java.lang.String da)
          Sets the message's destination address
 void setDestPort(int dp)
          Sets the message's destination port
 void setPerformative(java.lang.String p)
           
 void setSourceAddr(java.lang.String sa)
          Sets the message's source address
 void setSourcePort(int sp)
          Sets the message's source port
 java.lang.String toString()
          Stringify, not the same thing as the network-ready data string
 
Methods inherited from class utilities.Message
contentData, contentWord, getConnection, getContent, getData, getDestAddr, getDestPort, getReceiveTime, getSendTime, getSourceAddr, getSourcePort, receive, receive, receive, send, send, setConnection, setData, setReceiveTime, setSendTime
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KQMLMessage

public KQMLMessage(java.lang.String s)
Send in your encoded message to decode it
Parameters:
s - The KQML formatted message to decode

KQMLMessage

public KQMLMessage(java.lang.Object c,
                   java.lang.String da)
A "tell" message
Parameters:
c - The content to send
da - The destination address

KQMLMessage

public KQMLMessage(java.lang.String p,
                   java.lang.Object c,
                   java.lang.String da)
Normal constructor
Parameters:
p - The message performative (e.g. "ask", "tell", etc.)
c - The content to send
da - The destination address

KQMLMessage

public KQMLMessage(java.lang.String p,
                   java.lang.Object c,
                   java.lang.String da,
                   int po)
Normal constructor
Parameters:
p - The message performative (e.g. "ask", "tell", etc.)
c - The content to send
da - The destination address
po - The port number
Method Detail

addField

public void addField(java.lang.String fn,
                     java.lang.String fc)
Adds a field/ value pair to the message
Parameters:
fn - The name of the field to add (e.g. "in-reply-to")
fc - The content of that field (e.g. "pulse")

removeField

public void removeField(java.lang.String fn)
Removes a field/ value pair from the message
Parameters:
fn - The name of the field to remove (e.g. "in-reply-to")

getField

public java.lang.String getField(java.lang.String fn)
Get a field/ value pair to the message
Parameters:
fn - The name of the field to get (e.g. "in-reply-to")
Returns:
The content of that field

getPerformative

public java.lang.String getPerformative()
Performative accessors

setPerformative

public void setPerformative(java.lang.String p)

setContent

public void setContent(java.lang.Object c)
Sets the message's content string
Overrides:
setContent in class Message
Parameters:
c - The content

setDestAddr

public void setDestAddr(java.lang.String da)
Sets the message's destination address
Overrides:
setDestAddr in class Message
Parameters:
da - The destination, typically an agent's name

setDestPort

public void setDestPort(int dp)
Sets the message's destination port
Overrides:
setDestPort in class Message
Parameters:
sp - The destination port number

setSourceAddr

public void setSourceAddr(java.lang.String sa)
Sets the message's source address
Overrides:
setSourceAddr in class Message
Parameters:
sa - The source, the name of the agent sending the message

setSourcePort

public void setSourcePort(int sp)
Sets the message's source port
Overrides:
setSourcePort in class Message
Parameters:
sp - The source port number

contentWord

public java.lang.String contentWord()
Returns the first word in the content (used to determine the type of content), cleaning the KQML stuff off first
Overrides:
contentWord in class Message
Following copied from class: utilities.Message
Returns:
The word, or an empty string if none found

contentData

public java.lang.String contentData()
Returns the data in the content (the stuff after the first word in the content), cleaning the KQML stuff off first
Overrides:
contentData in class Message
Following copied from class: utilities.Message
Returns:
The data, or an empty string if none found

clone

public java.lang.Object clone()
Clone
Overrides:
clone in class Message

toString

public java.lang.String toString()
Stringify, not the same thing as the network-ready data string
Overrides:
toString in class Message