java.lang.Object
openjava.ptree.ParseTreeObject
openjava.ptree.NonLeaf
openjava.ptree.CastExpression
- All Implemented Interfaces:
- java.lang.Cloneable, Expression, ParseTree, VariableInitializer
- public class CastExpression
- extends NonLeaf
- implements Expression
The CastExpression class represents
a cast expression of parse tree.
If the operator in the expression of the right operand has week unity,
this automatically produces the code in which the right operand
is enclosed by parenthesises.
In the case the caster is int and
the right operand to be casted is p + q,
this produces the code :
(int) (p + q)
| Fields inherited from class openjava.ptree.NonLeaf |
|
| Methods inherited from class openjava.ptree.NonLeaf |
childrenAccept, elementAt, equals, getComment, getContents, getLength, makeRecursiveCopy, replaceChildWith, set, set, set, set, set, set, set, set, set, setComment, setElementAt |
| Methods inherited from class openjava.ptree.ParseTreeObject |
clone, equal, getObjectID, getParent, hashCode, lastObjectID, makeCopy, replace, setParent, toFlattenString, toString |
CastExpression
public CastExpression(TypeName ts,
Expression expr)
- Allocates a new object.
CastExpression
public CastExpression(openjava.mop.OJClass type,
Expression expr)
CastExpression
CastExpression()
getTypeSpecifier
public TypeName getTypeSpecifier()
- Gets the type specifier to cast in this expression.
setTypeSpecifier
public void setTypeSpecifier(TypeName tspec)
- Sets the type specifier to cast in this expression.
getExpression
public Expression getExpression()
- Gets the expression of the operand to be casted in this expression.
setExpression
public void setExpression(Expression expr)
- Sets the expression of the operand to be casted in this expression.
accept
public void accept(openjava.ptree.util.ParseTreeVisitor v)
throws ParseTreeException
- Description copied from interface:
ParseTree
- Accepts a
ParseTreeVisitor object as the role of a
Visitor in the Visitor pattern, as the role of an Element in the
Visitor pattern.
This invoke an appropriate visit() method on the
accepted visitor.
- Specified by:
accept in interface ParseTree- Specified by:
accept in class ParseTreeObject
getType
public openjava.mop.OJClass getType(openjava.mop.Environment env)
throws java.lang.Exception
- Specified by:
getType in interface Expression