Package 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$
- Author:
- Neil Smyth, University of California;, Zoltan Kemenczy, Research in Motion Limited
- See Also:
ASTPtRootNode
,PtParser
,Token
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Yellow (nsmyth)
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
_methodName
Need to store the method name of the method call.-
Fields inherited from class ptolemy.data.expr.ASTPtRootNode
_children, _id, _isConstant, _parent, _ptToken, _ptType
-
-
Constructor Summary
Constructors Constructor Description ASTPtMethodCallNode(int id)
ASTPtMethodCallNode(PtParser p, int id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
-
-
-
-
Constructor Detail
-
ASTPtMethodCallNode
public ASTPtMethodCallNode(int id)
-
ASTPtMethodCallNode
public ASTPtMethodCallNode(PtParser p, int id)
-
-
Method Detail
-
getMethodName
public java.lang.String getMethodName()
Return the name of the method invoked by this node.- Returns:
- 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 interfaceNode
- Overrides:
jjtClose
in classASTPtRootNode
-
visit
public void visit(ParseTreeVisitor visitor) throws IllegalActionException
Traverse this node with the given visitor.- Overrides:
visit
in classASTPtRootNode
- Parameters:
visitor
- The visitor.- Throws:
IllegalActionException
- Always thrown in this base class the visit() method is not implemented here.
-
-