package net.sourceforge.phpdt.internal.compiler.ast;
+import java.util.List;
+
import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
import net.sourceforge.phpdt.internal.ui.PHPUiImages;
+
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.text.Position;
-import java.util.List;
-import java.util.ArrayList;
-
/**
* @author Matthieu Casanova
*/
-public class InclusionStatement extends Statement implements Outlineable {
+public final class InclusionStatement extends Statement implements Outlineable {
public static final int INCLUDE = 0;
public static final int INCLUDE_ONCE = 1;
public static final int REQUIRE_ONCE = 3;
public boolean silent;
/** The kind of include. */
- public int keyword;
- public Expression expression;
+ private final int keyword;
+ private final Expression expression;
- private Object parent;
+ private final Object parent;
- private Position position;
+ private final Position position;
public InclusionStatement(final Object parent,
final int keyword,
final Expression expression,
- final int sourceStart) {
- super(sourceStart, expression.getSourceEnd());
+ final int sourceStart,
+ final int sourceEnd) {
+ super(sourceStart, sourceEnd);
this.keyword = keyword;
this.expression = expression;
this.parent = parent;
- position = new Position(sourceStart, getSourceEnd());
+ position = new Position(sourceStart, sourceEnd);
}
- public String keywordToString() {
+ private String keywordToString() {
switch (keyword) {
case INCLUDE:
return "include"; //$NON-NLS-1$
}
public String toString() {
- final StringBuffer buffer = new StringBuffer();
+ final String keyword = keywordToString();
+ final String expressionString = expression.toStringExpression();
+ final StringBuffer buffer = new StringBuffer(keyword.length() +
+ expressionString.length() + 2);
if (silent) {
buffer.append('@');
}
- buffer.append(keywordToString());
- buffer.append(" ");
- buffer.append(expression.toStringExpression());
+ buffer.append(keyword);
+ buffer.append(' ');
+ buffer.append(expressionString);
return buffer.toString();
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
+ *
+ * @param list the list where we will put variables
*/
- public List getOutsideVariable() {
- return expression.getOutsideVariable();
+ public void getOutsideVariable(final List list) {
+ expression.getOutsideVariable(list);
}
/**
* get the modified variables.
- * @return the variables from we change value
+ *
+ * @param list the list where we will put variables
*/
- public List getModifiedVariable() {
- return expression.getModifiedVariable();
+ public void getModifiedVariable(final List list) {
+ expression.getModifiedVariable(list);
}
/**
* Get the variables used.
- * @return the variables used
+ *
+ * @param list the list where we will put variables
*/
- public List getUsedVariable() {
- return expression.getUsedVariable();
+ public void getUsedVariable(final List list) {
+ expression.getUsedVariable(list);
}
}