/* Generated By:JJTree: Do not edit this line. SimpleNode.java */

package hiro.yoshioka.ast.sql.oracle;

import hiro.yoshioka.ast.sql.AbsSQLParser;
import hiro.yoshioka.ast.sql.AbsSimpleNode;

public class SimpleNode extends AbsSimpleNode implements Node {
	protected Node parent;
	protected Node[] children;

	public SimpleNode(int i) {
		super(i);
	}

	public SimpleNode(AbsSQLParser p, int i) {
		this(i);
		parser = p;
	}

	public void jjtOpen() {
		try {
			first = ((WolfSQLParser) parser).getToken(1);
			second = ((WolfSQLParser) parser).getToken(2);
			third = ((WolfSQLParser) parser).getToken(3);
		} catch (Throwable e) {
		}
	}

	public void jjtClose() {
		last = ((WolfSQLParser) parser).getToken(0);
	}

	public void jjtSetParent(Node n) {
		parent = n;
	}

	public Node jjtGetParent() {
		return parent;
	}

	public void jjtAddChild(Node n, int i) {
		if (children == null) {
			children = new Node[i + 1];
		} else if (i >= children.length) {
			Node c[] = new Node[i + 1];
			System.arraycopy(children, 0, c, 0, children.length);
			children = c;
		}
		children[i] = n;
	}

	public Node jjtGetChild(int i) {
		return children[i];
	}

	public int jjtGetNumChildren() {
		return (children == null) ? 0 : children.length;
	}

	/** Accept the visitor. **/
	public Object jjtAccept(WolfSQLParserVisitor visitor, Object data) {
		return visitor.visit(this, data);
	}

	/** Accept the visitor. **/
	public Object childrenAccept(WolfSQLParserVisitor visitor, Object data) {
		if (children != null) {
			for (int i = 0; i < children.length; ++i) {
				children[i].jjtAccept(visitor, data);
			}
		}
		return data;
	}

	@Override
	protected String[] getNodeNames() {
		return WolfSQLParserTreeConstants.jjtNodeName;
	}

	public String toString(String prefix) {
		return prefix + toString();
	}

	/*
	 * Override this method if you want to customize how the node dumps out its
	 * children.
	 */

	public void dump(String prefix) {
		System.out.println(toString(prefix));
		if (children != null) {
			for (int i = 0; i < children.length; ++i) {
				SimpleNode n = (SimpleNode) children[i];
				if (n != null) {
					n.dump(prefix + " ");
				}
			}
		}
	}

	public void dump2(String prefix) {
		System.out.println(toString2(prefix));
		if (children != null) {
			for (int i = 0; i < children.length; ++i) {
				SimpleNode n = (SimpleNode) children[i];
				if (n != null) {
					n.dump2(prefix + " ");
				}
			}
		}
	}

	public AbsSimpleNode getChild(int i) {
		return (AbsSimpleNode) jjtGetChild(i);
	}

	public AbsSimpleNode getParent() {
		return (AbsSimpleNode) parent;
	}

	public AbsSimpleNode[] getChildren() {
		if (children == null) {
			return EMPTY_ARRAY;
		}
		AbsSimpleNode[] ret = new AbsSimpleNode[children.length];
		for (int i = 0; i < ret.length; i++) {
			ret[i] = (AbsSimpleNode) children[i];
		}
		return ret;
	}
}
