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

Constructor Index

 o CastExpression(TypeSpecifier, Expression)
Allocates a new object.

Method Index

 o getExpression()
Gets the expression of the operand to be casted in this expression.
 o getTypeSpecifier()
Gets the type specifier to cast in this expression.
 o setExpression(Expression)
Sets the expression of the operand to be casted in this expression.
 o setTypeSpecifier(TypeSpecifier)
Sets the type specifier to cast in this expression.
 o writeCode()
Writes the code this parse-tree presents for.

Constructors

 o 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.

Methods

 o writeCode
 public void writeCode()
Writes the code this parse-tree presents for.

Overrides:
writeCode in class NonLeaf
 o getTypeSpecifier
 public TypeSpecifier getTypeSpecifier()
Gets the type specifier to cast in this expression.

Returns:
the type specifier.
 o setTypeSpecifier
 public void setTypeSpecifier(TypeSpecifier tspec)
Sets the type specifier to cast in this expression.

Parameters:
tspec - the type specifier.
 o getExpression
 public Expression getExpression()
Gets the expression of the operand to be casted in this expression.

Returns:
the expression.
 o 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