Package ptolemy.data.expr
Class ASTPtUnaryNode
- java.lang.Object
-
- ptolemy.data.expr.ASTPtRootNode
-
- ptolemy.data.expr.ASTPtUnaryNode
-
- All Implemented Interfaces:
java.lang.Cloneable
,Node
public class ASTPtUnaryNode extends ASTPtRootNode
The parse tree created from the expression string consists of a hierarchy of node objects. This class represents unary operator(!, -, ~) nodes in the parse tree.- Since:
- Ptolemy II 0.2
- Version:
- $Id$
- Author:
- Neil Smyth
- See Also:
ASTPtRootNode
,PtParser
,Token
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Yellow (nsmyth)
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
_isBitwiseNot
protected boolean
_isMinus
protected boolean
_isNot
protected Token
_lexicalToken
-
Fields inherited from class ptolemy.data.expr.ASTPtRootNode
_children, _id, _isConstant, _parent, _ptToken, _ptType
-
-
Constructor Summary
Constructors Constructor Description ASTPtUnaryNode(int id)
ASTPtUnaryNode(PtParser p, int id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Token
getOperator()
Return the token that represents the operation of this node.boolean
isBitwiseNot()
Return true if this node represents the bitwise negation of its child.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
isMinus()
Return true if this node represents the additive inverse of its child.boolean
isNot()
Return true if this node represents the boolean negation of its child.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
-
-
-
-
Field Detail
-
_isMinus
protected boolean _isMinus
-
_isNot
protected boolean _isNot
-
_isBitwiseNot
protected boolean _isBitwiseNot
-
_lexicalToken
protected Token _lexicalToken
-
-
Constructor Detail
-
ASTPtUnaryNode
public ASTPtUnaryNode(int id)
-
ASTPtUnaryNode
public ASTPtUnaryNode(PtParser p, int id)
-
-
Method Detail
-
getOperator
public Token getOperator()
Return the token that represents the operation of this node.- Returns:
- the token that represents the operation of this node.
-
isBitwiseNot
public boolean isBitwiseNot()
Return true if this node represents the bitwise negation of its child.- Returns:
- true if this node represents the bitwise negation of its child.
-
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 classASTPtRootNode
- 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.- Returns:
- True if this node is congruent.
-
isMinus
public boolean isMinus()
Return true if this node represents the additive inverse of its child.- Returns:
- true if this node represents the additive inverse of its child.
-
isNot
public boolean isNot()
Return true if this node represents the boolean negation of its child.- Returns:
- true if this node represents the boolean negation of its child.
-
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.
-
-