ptolemy.data.expr
Class ASTPtUnionConstructNode
java.lang.Object
ptolemy.data.expr.ASTPtRootNode
ptolemy.data.expr.ASTPtUnionConstructNode
- All Implemented Interfaces:
- java.lang.Cloneable, Node
public class ASTPtUnionConstructNode
- extends ASTPtRootNode
The parse tree created from the expression string consists of a
hierarchy of node objects. This class represents union construction using
the following syntax: {|foo = "abc"|}
. The result of
parsing and evaluating this expression is a union token with the label
foo, and the corresponding value is a StringToken of value "abc".
When using an expression to specify a union type, multiple labels
are allowed: {|foo = string, bar = int|}
, which is a union
type with two alternatives: one labeled foo with type string, one
labeled bar with type integer.
FIXME: ambiguity
- Since:
- Ptolemy II 5.2
- Version:
- $Id: ASTPtUnionConstructNode.java 43476 2006-08-21 23:54:24Z cxh $
- Author:
- Xiaojun Liu
- See Also:
ASTPtRootNode
,
PtParser
,
Token
- Accepted Rating:
- Proposed Rating:
Field Summary |
protected java.util.LinkedList |
_labelNames
The list of field names for the record. |
Method Summary |
java.util.List |
getLabelNames()
Return the list of label names for this union construct. |
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. |
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, toString |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
_labelNames
protected java.util.LinkedList _labelNames
- The list of field names for the record.
ASTPtUnionConstructNode
public ASTPtUnionConstructNode(int id)
ASTPtUnionConstructNode
public ASTPtUnionConstructNode(PtParser p,
int id)
getLabelNames
public java.util.List getLabelNames()
- Return the list of label names for this union construct.
The order of the list is not meaningful.
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.
visit
public void visit(ParseTreeVisitor visitor)
throws IllegalActionException
- Traverse this node with the given visitor.
- Overrides:
visit
in class ASTPtRootNode
- Throws:
IllegalActionException