ptolemy.data.expr
Class ASTPtMethodCallNode
java.lang.Object
ptolemy.data.expr.ASTPtRootNode
ptolemy.data.expr.ASTPtMethodCallNode
- All Implemented Interfaces:
- java.lang.Cloneable, Node
public class ASTPtMethodCallNode
- extends ASTPtRootNode
The parse tree created from the expression string consists of a
hierarchy of node objects. This class represents method call nodes
in the parse tree.
To allow extension of the parser capabilities without modifying
the kernel code, method calls on Tokens are supported with the following
syntax (token).methodName(comma separated arguments).
Method arguments are processed as described in ASTPtFunctionApplicationNode
. However, to allow element-by-element
method calls on ArrayTokens, the following sequence is followed here
to find a method to execute:
- Look for a method with tokens as supplied by PtParser.
- If that fails, convert all instances of ArrayToken to Token[] and
look again, element-by-element.
- If that fails, convert all method arguments to their underlying java
types and try again.
- Finally, if the above fails, convert the method object Token to
its underlying java type and try again.
- Since:
- Ptolemy II 0.2
- Version:
- $Id: ASTPtMethodCallNode.java 38798 2005-07-08 20:00:01Z cxh $
- Author:
- Neil Smyth, University of California;, Zoltan Kemenczy, Research in Motion Limited
- See Also:
ASTPtRootNode
,
PtParser
,
Token
- Accepted Rating:
- Proposed Rating:
Field Summary |
protected java.lang.String |
_methodName
Need to store the method name of the method call. |
Method Summary |
java.lang.String |
getMethodName()
Return the name of the method invoked by this node. |
void |
jjtClose()
This method is called after all the child nodes have been
added. |
void |
visit(ParseTreeVisitor visitor)
Traverse this node with the given visitor. |
Methods inherited from class ptolemy.data.expr.ASTPtRootNode |
clone, displayParseTree, evaluateParseTree, getToken, getType, isCongruent, isConstant, isEvaluated, jjtAddChild, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, setConstant, setToken, setType, toString, toString |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
_methodName
protected java.lang.String _methodName
- Need to store the method name of the method call.
ASTPtMethodCallNode
public ASTPtMethodCallNode(int id)
ASTPtMethodCallNode
public ASTPtMethodCallNode(PtParser p,
int id)
getMethodName
public java.lang.String getMethodName()
- Return the name of the method invoked by this node.
jjtClose
public void jjtClose()
- Description copied from interface:
Node
- This method is called after all the child nodes have been
added.
- Specified by:
jjtClose
in interface Node
- Overrides:
jjtClose
in class ASTPtRootNode
visit
public void visit(ParseTreeVisitor visitor)
throws IllegalActionException
- Traverse this node with the given visitor.
- Overrides:
visit
in class ASTPtRootNode
- Throws:
IllegalActionException