All Packages Class Hierarchy This Package Previous Next Index
Class openjava.ptree.CastExpression
java.lang.Object
|
+----openjava.ptree.PtreeObject
|
+----openjava.ptree.NonLeaf
|
+----openjava.ptree.CastExpression
- 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)
- See Also:
- NonLeaf, Expression, TypeSpecifier
-
CastExpression(TypeSpecifier, Expression)
- Allocates a new object.
-
getExpression()
- Gets the expression of the operand to be casted in this expression.
-
getTypeSpecifier()
- Gets the type specifier to cast in this expression.
-
setExpression(Expression)
- Sets the expression of the operand to be casted in this expression.
-
setTypeSpecifier(TypeSpecifier)
- Sets the type specifier to cast in this expression.
-
writeCode()
- Writes the code this parse-tree presents for.
CastExpression
public CastExpression(TypeSpecifier ts,
Expression expr)
- Allocates a new object.
- Parameters:
- ts - the type specifier to cast in this expression.
- expr - the expression to be casted in this expression.
writeCode
public void writeCode()
- Writes the code this parse-tree presents for.
- Overrides:
- writeCode in class NonLeaf
getTypeSpecifier
public TypeSpecifier getTypeSpecifier()
- Gets the type specifier to cast in this expression.
- Returns:
- the type specifier.
setTypeSpecifier
public void setTypeSpecifier(TypeSpecifier tspec)
- Sets the type specifier to cast in this expression.
- Parameters:
- tspec - the type specifier.
getExpression
public Expression getExpression()
- Gets the expression of the operand to be casted in this expression.
- Returns:
- the expression.
setExpression
public void setExpression(Expression expr)
- Sets the expression of the operand to be casted in this expression.
- Parameters:
- expr - the expression.
All Packages Class Hierarchy This Package Previous Next Index