*** empty log message ***
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / Define.java
1 package net.sourceforge.phpdt.internal.compiler.ast;
2
3 import org.eclipse.jface.text.Position;
4 import org.eclipse.jface.resource.ImageDescriptor;
5 import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
6 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
7
8 /**
9  * a Define.
10  * define(expression,expression)
11  * @author Matthieu Casanova
12  */
13 public class Define extends Statement implements Outlineable {
14
15   public Expression defineName,defineValue;
16
17   private Object parent;
18   private Position position;
19
20   public Define(Object parent,
21                 Expression defineName,
22                 Expression defineValue,
23                 int sourceStart,
24                 int sourceEnd) {
25     super(sourceStart, sourceEnd);
26     this.parent = parent;
27     this.defineName = defineName;
28     this.defineValue = defineValue;
29     position = new Position(sourceStart, sourceEnd);
30   }
31
32   public String toString(int tab) {
33     final StringBuffer buff = new StringBuffer(tabString(tab));
34     buff.append("define(");
35     buff.append(defineName.toStringExpression());
36     buff.append(defineValue.toStringExpression());
37     buff.append(")");
38     return buff.toString();
39   }
40
41   public String toString() {
42     final StringBuffer buff = new StringBuffer(defineName.toStringExpression());
43     buff.append(" = ");
44     buff.append(defineValue.toStringExpression());
45     return buff.toString();
46   }
47
48   public ImageDescriptor getImage() {
49     return PHPUiImages.DESC_VAR;
50   }
51
52   public Object getParent() {
53     return parent;
54   }
55
56   public Position getPosition() {
57     return position;
58   }
59 }