1 package net.sourceforge.phpdt.internal.compiler.ast;
3 import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
4 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
5 import org.eclipse.jface.resource.ImageDescriptor;
6 import org.eclipse.jface.text.Position;
9 import java.util.ArrayList;
12 * A Field declaration.
13 * This is a variable declaration for a php class
14 * In fact it's an array of VariableUsage, since a field could contains
17 * @author Matthieu Casanova
19 public class FieldDeclaration extends Statement implements Outlineable {
22 public VariableDeclaration[] vars;
24 private Object parent;
25 private Position position;
28 * @param vars the array of variables.
29 * @param sourceStart the starting offset
30 * @param sourceEnd the ending offset
32 public FieldDeclaration(final VariableDeclaration[] vars,
33 final int sourceStart,
35 final Object parent) {
36 super(sourceStart, sourceEnd);
39 position = new Position(sourceStart, sourceEnd);
43 * Return the object into String.
44 * @param tab how many tabs (not used here
47 public String toString(final int tab) {
48 final StringBuffer buff = new StringBuffer(tabString(tab));
49 buff.append("var ");//$NON-NLS-1$
50 for (int i = 0; i < vars.length; i++) {
52 buff.append(",");//$NON-NLS-1$
54 buff.append(vars[i].toStringExpression());
56 return buff.toString();
60 * Get the image of a variable.
61 * @return the image that represents a php variable
63 public ImageDescriptor getImage() {
64 return PHPUiImages.DESC_VAR;
67 public Object getParent() {
71 public Position getPosition() {
76 * Get the variables from outside (parameters, globals ...)
77 * @return the variables from outside
79 public List getOutsideVariable() {
80 return new ArrayList(1);
84 * get the modified variables.
85 * @return the variables from we change value
87 public List getModifiedVariable() {
88 return new ArrayList(1);
92 * Get the variables used.
93 * @return the variables used
95 public List getUsedVariable() {
96 return new ArrayList(1);