All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JavaAgent.resource.cdl.CDLDescription

java.lang.Object
   |
   +----JavaAgent.resource.cdl.CDLDescription

public class CDLDescription
extends Object
implements Parsable
A CDLDescription is a generic description of some capability. The language in which capabilities are described is CDL.


Variable Index

 o actionId
the action identifier for this capability
 o cAgent
the name of the agent that advertised the capability
 o isCapability
indicates whether this is a capability or a task description
 o stateLangClass
the class that represents the language for states
 o stateLangId
the resource identifier for the state language
 o superAct
the action from which this one inherits (or null)

Constructor Index

 o CDLDescription(String, String, Agent, Hashtable)
This constructor for a CDLDescription takes a String and parses it.

Method Index

 o clone()
This funcion returns a clone of this CDLDescription using the same Variables.
 o extractExpr(StreamTokenizer)
This function extracts an expression from the given StreamTokenizer.
 o getAction()
This function returns the action identifier for this capability.
 o getAgent()
This function returns the name of the agent that has this capability.
 o getInputConstrs()
 o getInputVars()
 o getIOConstrs()
 o getOutputConstrs()
 o getOutputVars()
 o getVars()
This fuction returns a Vector of Variables used in the input and output of this capability.
 o instantiate()
This function instantiates this capability description based on its super-action.
 o isCapability()
This function tests whether this CDLDescription is a capability description or a task description.
 o parseConstraints(StreamTokenizer)
This function parses a list of constraints.
 o parseParameters(StreamTokenizer)
This function parses a list of parameter specifications for a capability description.
 o parseProperties(StreamTokenizer)
This function parses a list of properties.
 o parseToken(StreamTokenizer, char)
This funtion parses a token from the given StreamTokenizer.
 o parseWord(StreamTokenizer, String)
This function parses a word from the given StreamTokenizer.
 o parseWord(StreamTokenizer, String, boolean)
This function parses a word from the given StreamTokenizer.
 o subsumes(CDLDescription)
This function tests whether this capability can perform the given task.
 o toString()
This function converts this CDL capability description into a printable (and parsable) String.

Variables

 o cAgent
 protected String cAgent
the name of the agent that advertised the capability

 o isCapability
 protected boolean isCapability
indicates whether this is a capability or a task description

 o stateLangId
 protected String stateLangId
the resource identifier for the state language

 o stateLangClass
 protected Class stateLangClass
the class that represents the language for states

 o actionId
 protected String actionId
the action identifier for this capability

 o superAct
 protected CDLDescription superAct
the action from which this one inherits (or null)

Constructors

 o CDLDescription
 public CDLDescription(String advertiser,
                       String CDstr,
                       Agent receiver,
                       Hashtable ontology) throws ParseException
This constructor for a CDLDescription takes a String and parses it. The given String is tokenized using a StreamTokenizer in which the characters ':' and '?' are treated as word characters.

Parameters:
advertiser - the name of the agent advertising the capability
CDstr - the String representing the CDLDescription
receiver - the broker which received the capability description
Throws: ParseException
An exception will occur if a syntactical or other type of error is discovered.
See Also:
StreamTokenizer

Methods

 o parseProperties
 protected static Vector parseProperties(StreamTokenizer st) throws IOException, ParseException
This function parses a list of properties.

Parameters:
st - the StreamTokenizer from which will be parsed
Returns:
a Vector of properties (Symbols)
Throws: ParseException
An exception can occur if the syntax is not as expected.
Throws: IOException
An exception will will be thrown if advancing on the StreamTokenizer fails.
 o parseParameters
 protected static Vector parseParameters(StreamTokenizer st) throws IOException, ParseException
This function parses a list of parameter specifications for a capability description. Currently, these consist just of a role name and a variable enclosed in round brackets.

Parameters:
st - the StreamTokenizer from which the specs will be parsed
Returns:
a Vector of parameter specifications
Throws: ParseException
An exception can occur if the syntax is not as expected.
Throws: IOException
An exception will will be thrown if advancing on the StreamTokenizer fails.
 o parseConstraints
 protected Vector parseConstraints(StreamTokenizer st) throws IOException, ParseException
This function parses a list of constraints. The list must be enclosed by round brackets and so must the constraints in the list. Each constraint must be a String representing an expression that can be parsed into a member of the class stored in stateLangClass.

Parameters:
st - the StreamTokenizer from which the constraints will be parsed
Returns:
a Vector of constraints; elements will be members of the class stored in stateLangClass
Throws: ParseException
An exception can occur if the brackets are not as expected or if a ParseException occurs during the parsing of the constraints including failure to instantiate the Class.
Throws: IOException
An exception will will be thrown if advancing on the StreamTokenizer fails.
 o extractExpr
 public static String extractExpr(StreamTokenizer st) throws IOException, ParseException
This function extracts an expression from the given StreamTokenizer. The expression must be in round brackets and the brackets within the expression must be balanced. The returned String will be this expression, but some of the spacing might have changed.

Parameters:
st - the StreamTokenizer from which the expression is to be read
Returns:
a String representing the extracted expression
Throws: ParseException
An exception can occur if the StreamTokenizer runs out of tokens before the final balancing brcket has been read.
Throws: IOException
An exception will will be thrown if advancing on the StreamTokenizer fails.
 o parseWord
 protected static String parseWord(StreamTokenizer st,
                                   String msg) throws IOException, ParseException
This function parses a word from the given StreamTokenizer. It returns a String that is the word that has been overread.

Parameters:
st - the StreamTokenizer from which to parse
msg - the error message to be displayed should a ParseException be thrown form this function
Returns:
the parsed word
Throws: ParseException
An exception may occur if the parsed was not a word token
Throws: IOException
An exception will will be thrown if advancing on the StreamTokenizer fails.
 o parseWord
 protected static boolean parseWord(StreamTokenizer st,
                                    String word,
                                    boolean throwIfNot) throws IOException, ParseException
This function parses a word from the given StreamTokenizer. It returns whether the parsed token was a word and equal to the given String and overreads the word token. However, if the given boolean was true is true then a ParseException will be thrown if the parsed word was not equal to the given String.

Parameters:
st - the StreamTokenizer from which to parse the token
word - the expected word
throwIfNot - indicates whether a ParseException should be thrown if the parsed token is not the given word
Returns:
whether the parsed token was the given word
Throws: ParseException
An exception may occur if the parsed word was not as expected and throwIfNot was true
Throws: IOException
An exception will will be thrown if advancing on the StreamTokenizer fails.
 o parseToken
 protected static void parseToken(StreamTokenizer st,
                                  char c) throws IOException, ParseException
This funtion parses a token from the given StreamTokenizer. If the type is the given character value then the token is overread. Otherwise a ParseException with a message that this character was expected will be thrown.

Parameters:
st - the StreamTokenizer from which to parse the token
c - the character indicating the expected token type
Throws: IOException
An exception will will be thrown if advancing on the StreamTokenizer fails.
Throws: ParseException
An exception will be thrown if the current token in the StreamTokenizer is not the expected character.
 o clone
 public Object clone()
This funcion returns a clone of this CDLDescription using the same Variables.

Overrides:
clone in class Object
 o subsumes
 public boolean subsumes(CDLDescription cdlTask) throws FormalismException
This function tests whether this capability can perform the given task.

 o getAgent
 public String getAgent()
This function returns the name of the agent that has this capability.

Returns:
the agent that has this capability
 o isCapability
 public boolean isCapability()
This function tests whether this CDLDescription is a capability description or a task description.

Returns:
true iff this is a capability description; false iff it is a task
 o getAction
 public String getAction()
This function returns the action identifier for this capability.

Returns:
the action identifier for this capability
 o getVars
 protected Vector getVars()
This fuction returns a Vector of Variables used in the input and output of this capability.

Returns:
the Vector of Variables used in the input and output of this capability
 o toString
 public String toString()
This function converts this CDL capability description into a printable (and parsable) String.

Returns:
the String representing this capability description
Overrides:
toString in class Object
 o instantiate
 public CDLDescription instantiate() throws FormalismException
This function instantiates this capability description based on its super-action.

Returns:
the instantiated version of this capability
 o getInputVars
 public Vector getInputVars() throws Exception
 o getOutputVars
 public Vector getOutputVars() throws Exception
 o getInputConstrs
 public Vector getInputConstrs()
 o getOutputConstrs
 public Vector getOutputConstrs()
 o getIOConstrs
 public Vector getIOConstrs()

All Packages  Class Hierarchy  This Package  Previous  Next  Index