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.
-
actionId
- the action identifier for this capability
-
cAgent
- the name of the agent that advertised the capability
-
isCapability
- indicates whether this is a capability or a task description
-
stateLangClass
- the class that represents the language for states
-
stateLangId
- the resource identifier for the state language
-
superAct
- the action from which this one inherits (or null)
-
CDLDescription(String, String, Agent, Hashtable)
- This constructor for a CDLDescription takes a String and parses it.
-
clone()
- This funcion returns a clone of this CDLDescription using the same
Variables.
-
extractExpr(StreamTokenizer)
- This function extracts an expression from the given StreamTokenizer.
-
getAction()
- This function returns the action identifier for this capability.
-
getAgent()
- This function returns the name of the agent that has this capability.
-
getInputConstrs()
-
-
getInputVars()
-
-
getIOConstrs()
-
-
getOutputConstrs()
-
-
getOutputVars()
-
-
getVars()
- This fuction returns a Vector of Variables used in the input and
output of this capability.
-
instantiate()
- This function instantiates this capability description based on
its super-action.
-
isCapability()
- This function tests whether this CDLDescription is a capability
description or a task description.
-
parseConstraints(StreamTokenizer)
- This function parses a list of constraints.
-
parseParameters(StreamTokenizer)
- This function parses a list of parameter specifications for a
capability description.
-
parseProperties(StreamTokenizer)
- This function parses a list of properties.
-
parseToken(StreamTokenizer, char)
- This funtion parses a token from the given StreamTokenizer.
-
parseWord(StreamTokenizer, String)
- This function parses a word from the given StreamTokenizer.
-
parseWord(StreamTokenizer, String, boolean)
- This function parses a word from the given StreamTokenizer.
-
subsumes(CDLDescription)
- This function tests whether this capability can perform the given
task.
-
toString()
-
This function converts this CDL capability description into
a printable (and parsable) String.
cAgent
protected String cAgent
- the name of the agent that advertised the capability
isCapability
protected boolean isCapability
- indicates whether this is a capability or a task description
stateLangId
protected String stateLangId
- the resource identifier for the state language
stateLangClass
protected Class stateLangClass
- the class that represents the language for states
actionId
protected String actionId
- the action identifier for this capability
superAct
protected CDLDescription superAct
- the action from which this one inherits (or null)
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
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.
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.
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.
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.
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.
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.
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.
clone
public Object clone()
- This funcion returns a clone of this CDLDescription using the same
Variables.
- Overrides:
- clone in class Object
subsumes
public boolean subsumes(CDLDescription cdlTask) throws FormalismException
- This function tests whether this capability can perform the given
task.
getAgent
public String getAgent()
- This function returns the name of the agent that has this capability.
- Returns:
- the agent that has this capability
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
getAction
public String getAction()
- This function returns the action identifier for this capability.
- Returns:
- the action identifier for this capability
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
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
instantiate
public CDLDescription instantiate() throws FormalismException
- This function instantiates this capability description based on
its super-action.
- Returns:
- the instantiated version of this capability
getInputVars
public Vector getInputVars() throws Exception
getOutputVars
public Vector getOutputVars() throws Exception
getInputConstrs
public Vector getInputConstrs()
getOutputConstrs
public Vector getOutputConstrs()
getIOConstrs
public Vector getIOConstrs()
All Packages Class Hierarchy This Package Previous Next Index