--- /dev/null
+package net.sourceforge.phpeclipse.phpeditor.phpparser;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * An abstract PHPSegment that can have children.
+ * @author khartlage, Matthieu Casanova
+ */
+public abstract class PHPSegmentWithChildren extends PHPSegment {
+ private ArrayList children;
+
+ /**
+ * Create a PHPSegment that can have children (class or functions).
+ * @param parent the parent object (it should be a php class)
+ * @param name the name of the function
+ * @param index where the function is in the file
+ */
+ public PHPSegmentWithChildren(Object parent, String name, int index) {
+ super(parent, name, index);
+ children = new ArrayList();
+ }
+
+ public List getList( ) {
+ return children;
+ }
+
+ /**
+ * Appends the specified PHPSegment declaration
+ *
+ * @param o function declaration to be appended to this list.
+ * @return <tt>true</tt> (as per the general contract of Collection.add).
+ */
+ public boolean add(PHPSegment o) {
+ return children.add(o);
+ }
+
+ /**
+ * Returns the PHPSegment declaration at the specified position in this list.
+ *
+ * @param index index of function declaration to return.
+ * @return the function declaration at the specified position in this list.
+ * @throws java.lang.IndexOutOfBoundsException if index is out of range <tt>(index
+ * < 0 || index >= size())</tt>.
+ */
+ public PHPSegment get(int index) {
+ return (PHPSegment) children.get(index);
+ }
+
+ /**
+ * Returns the number of declarations in this list.
+ *
+ * @return the number of declarations in this list.
+ */
+ public int size() {
+ return children.size();
+ }
+}