blob: 64258536231ec534feddb3b3c5bf15a2b99bcf39 [file] [log] [blame]
package org.eclipse.gymnast.examples.game.lang.gen.ast;
import java.util.ArrayList;
import org.eclipse.gymnast.runtime.core.ast.ASTNode;
import org.eclipse.gymnast.runtime.core.ast.TokenInfo;
/**
*
* @generated by Gymnast from game.ast on Jun 7, 2006 1:11:57 AM
*/
public class CommandList extends GameASTNode {
private ArrayList _children = new ArrayList();
/**
* @return the number of children of this ASTNode
*/
public int getChildCount() {
return _children.size();
}
/**
* @param index the index of a child ASTNode to get
* @return the child ASTNode at the given index
* @throws IndexOutOfBoundsException when the index is out of bounds
*/
public ASTNode getChild(int index) {
return (ASTNode)_children.get(index);
}
/**
* Add a child to this list.
*/
public void addChild(GameASTNode child) {
if (child == null) return;
if (child._parent != null) throw new RuntimeException();
_children.add(child);
child._parent = this;
}
/**
* Wrap the provided Token in a GameTokenNode
* and add it as a child of this node.
*
* @param token the Token to be added as a child of this node
*/
public void addChild(TokenInfo tokenInfo) {
addChild(new GameTokenNode(tokenInfo));
}
/**
* Construct a new CommandList.
*/
public CommandList() {
super();
}
/**
* This method overrides the superclass <code>acceptImpl</code> providing
* the same implementation. Here <code>this</code> refers to this specific node
* class, so the <code>beginVisit</code> and <code>endVisit</code> methods
* specific to this type in the visitor will be invoked.
*/
public void acceptImpl(GameASTNodeVisitor visitor) {
boolean visitChildren = visitor.beginVisit(this);
if (visitChildren) visitChildren(visitor);
visitor.endVisit(this);
}
}