*** empty log message ***
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / CastExpression.java
1 package net.sourceforge.phpdt.internal.compiler.ast;
2
3 /**
4  * This is a cast expression.
5  * @author Matthieu Casanova
6  */
7 public class CastExpression extends Expression {
8
9   /** The type in which we cast the expression. */
10   public ConstantIdentifier type;
11
12   /** The expression to be casted. */
13   public Expression expression;
14
15   /**
16    * Create a cast expression.
17    * @param type the type
18    * @param expression the expression
19    * @param sourceStart starting offset
20    * @param sourceEnd ending offset
21    */
22   public CastExpression(ConstantIdentifier type,
23                         Expression expression,
24                         int sourceStart,
25                         int sourceEnd) {
26     super(sourceStart, sourceEnd);
27     this.type = type;
28     this.expression = expression;
29   }
30
31   /**
32    * Return the expression as String.
33    * @return the expression
34    */
35   public String toStringExpression() {
36     final StringBuffer buff = new StringBuffer("(");
37     buff.append(type.toStringExpression());
38     buff.append(") ");
39     buff.append(expression.toStringExpression());
40     return buff.toString();
41   }
42 }