All Packages Class Hierarchy This Package Previous Next Index
Class KQMLLayer.KQMLmessage
KQMLLayer.KQMLmessage
- public class KQMLmessage
KQMLmessage class.
Basically KQMLmessage is a Hashtable with key field as slot name and field value
as slot value. The peformative key is assumed key as performative. You can retrieve
slot value using getValue(String slotname). If you want to retrieve performative,
use String perf = kqmlmessage.getValue("performative") where kqmlmessage is instantce
of KQMLmessage. The KQML parse has limitations:
- It does not allow unpaired opened,closed parenthesis.
Therefore, string (tell :sender xx :receiver yy :content ((error) will throw ParseException
since the message is not closed with paired parenthesis
- It does not distinguish the quoted string>
Therefore, in (tell :sender "me"), getValue("sender") is "me", not me.
-
performative
- Default constructor
-
KQMLmessage()
-
-
KQMLmessage(KQMLStreamTokenizer)
-
-
KQMLmessage(String)
- Given string, create KQMLmessage object
-
addFieldExpressionPair(String, KQMLExpression)
-
-
addFieldValuePair(String, String)
- add field, value pair to construct a KMQLmessage
-
getExpression(String)
-
-
getReadString()
- Returns the KQML message as a single human readable string.
-
getSendString()
- Returns the KQML message as a single machine readable string.
-
getValue(String)
- Returns the value of the "field" field.
-
parseMessage(KQMLStreamTokenizer)
-
-
parseMessage(String)
- Parse message according to the KQML syntax
performative
public String performative
- Default constructor
KQMLmessage
public KQMLmessage()
KQMLmessage
public KQMLmessage(String message) throws ParseException
- Given string, create KQMLmessage object
- Parameters:
- message - String which has legal KQML syntax
- Throws: ParseException
- if syntax does not match.
KQMLmessage
public KQMLmessage(KQMLStreamTokenizer message) throws ParseException
parseMessage
public void parseMessage(String str) throws ParseException
- Parse message according to the KQML syntax
- Parameters:
- str - KQML syntax string
- Throws: ParseException
- if syntax does not match
parseMessage
public void parseMessage(KQMLStreamTokenizer parser) throws ParseException
addFieldValuePair
public void addFieldValuePair(String field,
String value)
- add field, value pair to construct a KMQLmessage
- Parameters:
- field - slot name
addFieldExpressionPair
public void addFieldExpressionPair(String field,
KQMLExpression value)
getValue
public String getValue(String field)
- Returns the value of the "field" field. If it does not exit, returns null.
- Returns:
- String representing field value.
getExpression
public KQMLExpression getExpression(String field)
getReadString
public String getReadString()
- Returns the KQML message as a single human readable string.
- Returns:
- Message in string format.
getSendString
public String getSendString()
- Returns the KQML message as a single machine readable string.
This is the format which is sent to other agents.
- Returns:
- Message in string format.
All Packages Class Hierarchy This Package Previous Next Index