*** empty log message ***
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / FieldDeclaration.java
1 package net.sourceforge.phpdt.internal.compiler.ast;
2
3 /**
4  * A Field declaration.
5  * This is a variable declaration for a php class
6  * In fact it's an array of VariableDeclaration, since a field could contains
7  * several vars :
8  * var $toto,$tata;
9  * @author Matthieu Casanova
10  */
11 public class FieldDeclaration extends Statement {
12
13   /** The variables. */
14   public VariableDeclaration[] vars;
15
16   /**
17    * Create a new field.
18    * @param vars the array of variables.
19    * @param sourceStart the starting offset
20    * @param sourceEnd   the ending offset
21    */
22   public FieldDeclaration(VariableDeclaration[] vars, int sourceStart, int sourceEnd) {
23     super(sourceStart, sourceEnd);
24     this.vars = vars;
25   }
26
27   /**
28    * Return the object into String.
29    * @param tab how many tabs (not used here
30    * @return a String
31    */
32   public String toString(int tab) {
33     final StringBuffer buff = new StringBuffer(tabString(tab));
34     buff.append("var ");//$NON-NLS-1$
35     for (int i = 0; i < vars.length; i++) {
36       VariableDeclaration var = vars[i];
37       if (i != 0) {
38         buff.append(',');//$NON-NLS-1$
39       }
40       buff.append(var.toStringExpression());
41     }
42     return buff.toString();
43   }
44 }