org.opencyc.util
Class Amp

java.lang.Object
  |
  +--org.opencyc.util.Amp
All Implemented Interfaces:
java.io.Serializable

public class Amp
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
protected  java.lang.String ampString
          The AMP message in string form.
protected  java.lang.String content
          The content of the message.
protected  java.lang.String force
          Force indicator.
protected  java.lang.String inReplyTo
          The ID of the message for which this message is a reply.
protected  java.lang.String language
          The (computer) language in which the content is written.
protected  java.lang.String ontology
          The semantics defining the meaning of terms in the content.
protected  java.lang.String performative
          The AMP performative (command).
protected  java.lang.String receiver
          The ID of the receiver of the message.
protected  java.lang.String replyWith
          The reference message ID to be used in a subsequent reply.
protected  java.lang.String sender
          The ID of the sender of the message.
 
Constructor Summary
Amp()
          Constructs an emply AMP message.
Amp(java.lang.String ampString)
          Constructs a AMP object given the Amp message string.
 
Method Summary
 java.lang.String ampString()
          Returns the ampString.
 java.lang.String content()
          Returns the content.
 Amp createReply()
          Creates a trivial AMP reply message.
 java.lang.String force()
          Returns the force.
 void generateAmpString()
          Sets the AMP string according to the existing values of the performative parameters.
 java.lang.String inReplyTo()
          Returns the inReplyTo.
 java.lang.String language()
          Returns the language.
 java.lang.String ontology()
          Returns the ontology.
 java.lang.String parseAmpPerformativeParameter(java.lang.String keyword)
          Returns the performative parameter value for the argument.
 java.lang.String parsePerformative()
          Returns the performative word in the AMP string.
 void parsePerformativeParameters()
          Constructs a AMP object using the current Amp message string.
static int parseSExpression(java.lang.String aString)
          Returns an index indicating the end of the next symbolic expression substring.
 java.lang.String performative()
          Returns the performative.
 java.lang.String receiver()
          Returns the receiver.
 java.lang.String replyWith()
          Returns the replyWith.
 java.lang.String sender()
          Returns the sender.
 void setContent(java.lang.String content)
          Sets the content.
 void setContentString(java.lang.String content)
          Sets the content, wrapping it in quote delimiters.
 void setForce(java.lang.String force)
          Sets the force.
 void setInReplyTo(java.lang.String inReplyTo)
          Sets the inReplyTo.
 void setInReplyToString(java.lang.String inReplyTo)
          Sets the inReplyTo, wrapping it in quote delimiters.
 void setLanguage(java.lang.String language)
          Sets the language.
 void setOntology(java.lang.String ontology)
          Sets the ontology.
 void setPerformative(java.lang.String performative)
          Sets the performative.
 void setReceiver(java.lang.String receiver)
          Sets the receiver.
 void setReplyWith(java.lang.String replyWith)
          Sets the replyWith.
 void setSender(java.lang.String sender)
          Sets the sender.
static void test()
          Test the methods of this class.
 java.lang.String toString()
          Returns the AMP message string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ampString

protected java.lang.String ampString
The AMP message in string form.

performative

protected java.lang.String performative
The AMP performative (command).

sender

protected java.lang.String sender
The ID of the sender of the message.

receiver

protected java.lang.String receiver
The ID of the receiver of the message.

replyWith

protected java.lang.String replyWith
The reference message ID to be used in a subsequent reply.

inReplyTo

protected java.lang.String inReplyTo
The ID of the message for which this message is a reply.

content

protected java.lang.String content
The content of the message.

language

protected java.lang.String language
The (computer) language in which the content is written.

ontology

protected java.lang.String ontology
The semantics defining the meaning of terms in the content.

force

protected java.lang.String force
Force indicator.
Constructor Detail

Amp

public Amp(java.lang.String ampString)
Constructs a AMP object given the Amp message string.
Parameters:
ampString - the Amp message string

Amp

public Amp()
Constructs an emply AMP message.
Method Detail

toString

public java.lang.String toString()
Returns the AMP message string.
Overrides:
toString in class java.lang.Object
Returns:
the AMP message string

generateAmpString

public void generateAmpString()
Sets the AMP string according to the existing values of the performative parameters.

ampString

public java.lang.String ampString()
Returns the ampString.
Returns:
the ampString

performative

public java.lang.String performative()
Returns the performative.
Returns:
the performative

setPerformative

public void setPerformative(java.lang.String performative)
Sets the performative.
Parameters:
performative - the performative

sender

public java.lang.String sender()
Returns the sender.
Returns:
the sender

setSender

public void setSender(java.lang.String sender)
Sets the sender.
Parameters:
sender - the sender

receiver

public java.lang.String receiver()
Returns the receiver.
Returns:
the receiver

setReceiver

public void setReceiver(java.lang.String receiver)
Sets the receiver.
Parameters:
receiver - the receiver

replyWith

public java.lang.String replyWith()
Returns the replyWith.
Returns:
the replyWith

setReplyWith

public void setReplyWith(java.lang.String replyWith)
Sets the replyWith.
Parameters:
replyWith - the replyWith

inReplyTo

public java.lang.String inReplyTo()
Returns the inReplyTo.
Returns:
the inReplyTo

setInReplyToString

public void setInReplyToString(java.lang.String inReplyTo)
Sets the inReplyTo, wrapping it in quote delimiters.
Parameters:
inReplyTo - the inReplyTo

setInReplyTo

public void setInReplyTo(java.lang.String inReplyTo)
Sets the inReplyTo.
Parameters:
inReplyTo - the inReplyTo

content

public java.lang.String content()
Returns the content.
Returns:
the content

setContent

public void setContent(java.lang.String content)
Sets the content.
Parameters:
content - the content

setContentString

public void setContentString(java.lang.String content)
Sets the content, wrapping it in quote delimiters.
Parameters:
content - the content

language

public java.lang.String language()
Returns the language.
Returns:
the language

setLanguage

public void setLanguage(java.lang.String language)
Sets the language.
Parameters:
language - the language

ontology

public java.lang.String ontology()
Returns the ontology.
Returns:
the ontology

setOntology

public void setOntology(java.lang.String ontology)
Sets the ontology.
Parameters:
ontology - the ontology

force

public java.lang.String force()
Returns the force.
Returns:
the force

setForce

public void setForce(java.lang.String force)
Sets the force.
Parameters:
force - the force

createReply

public Amp createReply()
Creates a trivial AMP reply message.

parsePerformativeParameters

public void parsePerformativeParameters()
Constructs a AMP object using the current Amp message string.

parsePerformative

public java.lang.String parsePerformative()
Returns the performative word in the AMP string.
Returns:
the performative word in the AMP string

parseAmpPerformativeParameter

public java.lang.String parseAmpPerformativeParameter(java.lang.String keyword)
Returns the performative parameter value for the argument.
Parameters:
keyword - the AMP keyword for which the value is sought
Returns:
the performative parameter value for the argument

parseSExpression

public static int parseSExpression(java.lang.String aString)
Returns an index indicating the end of the next symbolic expression substring.
Parameters:
aString - the input string containing a symbolic expression
Returns:
an int index indicating the end of the next symbolic expression substring

test

public static void test()
Test the methods of this class.