|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--utilities.Message
Base inter-agent (or whatever..) message class.
Constructor Summary | |
Message()
Constructor, dosen't do anything. |
|
Message(java.lang.Object c)
Constructor |
|
Message(java.lang.Object c,
java.lang.String da,
int dp)
Constructor |
|
Message(java.lang.Object c,
java.lang.String sa,
int sp,
java.lang.String da,
int dp)
Constructor |
Method Summary | |
java.lang.Object |
clone()
Clone |
java.lang.String |
contentData()
Returns the string after the first word in the content (used to get the supposed data out of the content). |
java.lang.String |
contentData(java.lang.String str)
Returns the string after the first word in the string. |
java.lang.String |
contentWord()
Returns the first word in the content (used to determine the type of content). |
java.lang.String |
contentWord(java.lang.String str)
Returns the first word in the string. |
Connection |
getConnection()
|
java.lang.Object |
getContent()
Accessor functions |
java.lang.String |
getData()
|
java.lang.String |
getDestAddr()
|
int |
getDestPort()
|
int |
getReceiveTime()
|
int |
getSendTime()
|
java.lang.String |
getSourceAddr()
|
int |
getSourcePort()
|
static java.lang.String |
receive(java.io.BufferedReader b)
Same as above, but uses MSG_DELIM as the delimiter. |
static java.lang.String |
receive(java.io.BufferedReader b,
int length)
Recieves a message (string) from a stream. |
static java.lang.String |
receive(java.io.BufferedReader b,
java.lang.String d)
Recieves a message (string) from a stream. |
boolean |
send(java.io.BufferedWriter b)
Same as above, but uses MSG_DELIM as the delimiter. |
boolean |
send(java.io.BufferedWriter b,
java.lang.String d)
Sends the message across a stream |
void |
setConnection(Connection c)
|
void |
setContent(java.lang.Object c)
|
void |
setData(java.lang.String d)
|
void |
setDestAddr(java.lang.String da)
|
void |
setDestPort(int dp)
|
void |
setReceiveTime(int t)
|
void |
setSendTime(int t)
|
void |
setSourceAddr(java.lang.String sa)
|
void |
setSourcePort(int sp)
|
java.lang.String |
toString()
Stringify's the message. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Message()
public Message(java.lang.Object c)
c
- The message to sendpublic Message(java.lang.Object c, java.lang.String da, int dp)
c
- The message to sendda
- The destination addressdp
- The destination portpublic Message(java.lang.Object c, java.lang.String sa, int sp, java.lang.String da, int dp)
c
- The message to sendsa
- The source addresssp
- The source portda
- The destination addressdp
- The destination portMethod Detail |
public java.lang.Object getContent()
public void setContent(java.lang.Object c)
public java.lang.String getData()
public void setData(java.lang.String d)
public Connection getConnection()
public void setConnection(Connection c)
public java.lang.String getSourceAddr()
public void setSourceAddr(java.lang.String sa)
public int getSourcePort()
public void setSourcePort(int sp)
public java.lang.String getDestAddr()
public void setDestAddr(java.lang.String da)
public int getDestPort()
public void setDestPort(int dp)
public int getSendTime()
public void setSendTime(int t)
public int getReceiveTime()
public void setReceiveTime(int t)
public java.lang.String contentWord()
public java.lang.String contentWord(java.lang.String str)
str
- The string to examinepublic java.lang.String contentData()
public java.lang.String contentData(java.lang.String str)
str
- The string to examinepublic boolean send(java.io.BufferedWriter b)
b
- The writer to use to send the messagepublic boolean send(java.io.BufferedWriter b, java.lang.String d)
b
- The writer to use to send the messaged
- The message delimiterpublic static java.lang.String receive(java.io.BufferedReader b, java.lang.String d)
b
- The reader used to get the messaged
- The message delimiterpublic static java.lang.String receive(java.io.BufferedReader b)
b
- The reader used to get the messagepublic static java.lang.String receive(java.io.BufferedReader b, int length)
b
- The reader used to get the messagelength
- The length of the data to readpublic java.lang.Object clone()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |