package net.sourceforge.phpdt.internal.compiler.ast;
import java.util.List;
+import java.util.ArrayList;
/**
* It will be the mother of our own ast tree for php just like the ast tree of Eclipse.
public abstract class AstNode {
/** Starting and ending position of the node in the sources. */
- private int sourceStart, sourceEnd;
+ public int sourceStart, sourceEnd;
/**
* Create a node giving starting and ending offset
* @param sourceEnd ending offset
*/
public AstNode(final int sourceStart, final int sourceEnd) {
- this.setSourceStart(sourceStart);
- this.setSourceEnd(sourceEnd);
+ this.sourceStart = sourceStart;
+ this.sourceEnd = sourceEnd;
}
/**
*/
public abstract List getUsedVariable();
- public int getSourceStart() {
- return sourceStart;
- }
-
- public int getSourceEnd() {
- return sourceEnd;
- }
-
- public void setSourceStart(int sourceStart) {
- this.sourceStart = sourceStart;
+ /**
+ * This method will analyze the code.
+ * by default it will do nothing
+ */
+ public void analyzeCode() {
}
- public void setSourceEnd(int sourceEnd) {
- this.sourceEnd = sourceEnd;
+ /**
+ * Check if the array array contains the object o
+ * @param array an array
+ * @param o an obejct
+ * @return true if the array contained the object o
+ */
+ public boolean arrayContains(Object[] array, Object o) {
+ for (int i = 0; i < array.length; i++) {
+ if (array[i].equals(o)) {
+ return true;
+ }
+ }
+ return false;
}
}