ptolemy.data.expr
Class ASTPtLeafNode

java.lang.Object
  extended by ptolemy.data.expr.ASTPtRootNode
      extended by ptolemy.data.expr.ASTPtLeafNode
All Implemented Interfaces:
java.lang.Cloneable, Node

public class ASTPtLeafNode
extends ASTPtRootNode

The parse tree created from the expression string consists of a hierarchy of node objects. This class represents the leaf nodes of the tree.

Since:
Ptolemy II 0.2
Version:
$Id: ASTPtLeafNode.java 38798 2005-07-08 20:00:01Z cxh $
Author:
Neil Smyth
See Also:
ASTPtRootNode, PtParser, Token
Accepted Rating:
Red (cxh)
Proposed Rating:
Yellow (nsmyth)

Field Summary
protected  java.lang.String _name
          The identifier that this leaf node refers to.
 
Fields inherited from class ptolemy.data.expr.ASTPtRootNode
_children, _id, _isConstant, _parent, _ptToken, _ptType
 
Constructor Summary
ASTPtLeafNode(int id)
           
ASTPtLeafNode(PtParser p, int id)
           
 
Method Summary
 java.lang.String getName()
          Return the name that this node refers to.
 boolean isCongruent(ASTPtRootNode node, java.util.Map renaming)
          Return true if this node is (hierarchically) congruent to the given node, under the given renaming of bound identifiers.
 boolean isIdentifier()
          Return true if the leaf is an identifier that must be evaluated in scope.
 java.lang.String toString()
          Return a string representation
 void visit(ParseTreeVisitor visitor)
          Traverse this node with the given visitor.
 
Methods inherited from class ptolemy.data.expr.ASTPtRootNode
clone, displayParseTree, evaluateParseTree, getToken, getType, isConstant, isEvaluated, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, setConstant, setToken, setType, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_name

protected java.lang.String _name
The identifier that this leaf node refers to.

Constructor Detail

ASTPtLeafNode

public ASTPtLeafNode(int id)

ASTPtLeafNode

public ASTPtLeafNode(PtParser p,
                     int id)
Method Detail

getName

public java.lang.String getName()
Return the name that this node refers to. This may be a literal value, such as "5", or a reference to another object, such as the name of a variable in scope.


isCongruent

public boolean isCongruent(ASTPtRootNode node,
                           java.util.Map renaming)
Return true if this node is (hierarchically) congruent to the given node, under the given renaming of bound identifiers. Derived classes should extend this method to add additional necessary congruency checks.

Overrides:
isCongruent in class ASTPtRootNode
Parameters:
node - The node to compare to.
renaming - A map from String to String that gives a renaming from identifiers in this node to identifiers in the given node.

isIdentifier

public boolean isIdentifier()
Return true if the leaf is an identifier that must be evaluated in scope.


toString

public java.lang.String toString()
Return a string representation

Overrides:
toString 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