//---------------------------------------------------------------------------
// Constructor for empty KQML message
//---------------------------------------------------------------------------
public KQMLmessage() {
//---------------------------------------------------------------------------
// Constructor that is passed a string to make a message
//---------------------------------------------------------------------------
public KQMLmessage (String message) {
//---------------------------------------------------------------------------
// 27-Oct-98-garof:
// I revised this method to permit embedded or trailing colons to not be
// confused with keywords.
// Ex. (":time 14:23:01") should parse as 'field=time' and 'value=14:23:01'.
// Ex. (":time time:") should parse as 'field=time' and 'value=time:'.
//
// Original author's comments:
// This parses a KQML message. It isn't very sophisticated, it just assumes
// the following: a KQML message is a list of field value pairs enclosed in
// parentheses and separated by either blanks, tabs or new lines (between
// field and values and between pairs)
//
// A field is either a performative in which case it is not preceded by a :
// or a keyword in which case it is preceded by a :.
//
// a value is - either a word delineated by separators OR
// - enclosed between parentheses OR
// - null
//---------------------------------------------------------------------------
public synchronized void parseString(String message) {
// Sets the value of the field "field".
// @param field String key for the field.
// @param value String value for the field.
public void addFieldValuePair(String field, String value) {
/**
* Removes the "field" field.
* @param field String key for the field.
* @return String representing field value removed.
*/
public String removeField(String field) {
/**
* Returns the value of the "field" field. If it does not exit, returns null.
* @return String representing field value.
*/
public String getValue(String field) {
/** Return true if a field exists, even if it's value is null.
*/
public boolean existsField(String fieldName) {
/** Return true if a field exists and its value is not null.
*/
public boolean existsNonNullField(String fieldName) {
/** Return true if a field exists and its value is not
empty, i.e. it is not just a whitespace string.
*/
public boolean existsNonEmptyField(String fieldName) {
/** Remove all fields from the msg.
*/
public void clearMsg() {
/** Return an Enumeration of all the field names in a msg. This
also includes the field name PERFORMATIVE_KEY if it is present.
*/
public Enumeration getFieldNames() {
/** Returns the KQML message as a single machine readable string.
This is the format which is sent to other agents.
Fields that are null are excluded but fields whose values
are whitespace strings are included.
*/
public String toString() {