| package org.eclipse.gymnast.examples.game.lang.gen.ast; |
| |
| 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 Move extends Command { |
| |
| public static final String KW_MOVE = "move"; |
| |
| private OptReps _optReps; |
| private GameTokenNode _move_KW; |
| private Direction _direction; |
| private GameTokenNode _semi; |
| |
| public OptReps getOptReps() { |
| return _optReps; |
| } |
| public GameTokenNode getMove_KW() { |
| return _move_KW; |
| } |
| public Direction getDirection() { |
| return _direction; |
| } |
| public GameTokenNode getSemi() { |
| return _semi; |
| } |
| |
| |
| /** |
| * @return the number of children of this ASTNode |
| */ |
| public int getChildCount() { |
| int count = 0; |
| if (_optReps != null) count++; |
| if (_move_KW != null) count++; |
| if (_direction != null) count++; |
| if (_semi != null) count++; |
| |
| return count; |
| } |
| |
| /** |
| * @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) { |
| int count = -1; |
| if ((_optReps != null) && (++count == index)) return _optReps; |
| if ((_move_KW != null) && (++count == index)) return _move_KW; |
| if ((_direction != null) && (++count == index)) return _direction; |
| if ((_semi != null) && (++count == index)) return _semi; |
| |
| throw new IndexOutOfBoundsException(); |
| } |
| |
| /** |
| * Construct a new Move. |
| */ |
| public Move( |
| OptReps optReps, |
| TokenInfo move_KW, |
| Direction direction, |
| TokenInfo semi |
| ) { |
| super(); |
| |
| if (optReps != null) { |
| _optReps = optReps; |
| if (_optReps._parent != null) throw new RuntimeException(); |
| _optReps._parent = this; |
| } |
| if (move_KW != null) { |
| _move_KW = new GameTokenNode(move_KW); |
| if (_move_KW._parent != null) throw new RuntimeException(); |
| _move_KW._parent = this; |
| } |
| if (direction != null) { |
| _direction = direction; |
| if (_direction._parent != null) throw new RuntimeException(); |
| _direction._parent = this; |
| } |
| if (semi != null) { |
| _semi = new GameTokenNode(semi); |
| if (_semi._parent != null) throw new RuntimeException(); |
| _semi._parent = this; |
| } |
| |
| } |
| |
| /** |
| * 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); |
| } |
| |
| } |