public TerminalNode getToken(int ttype, int i) {if ( children==null || i < 0 || i >= children.size() ) {return null;}int j = -1; for (ParseTree o : children) {if ( o instanceof TerminalNode ) {TerminalNode tnode = (TerminalNode)o;Token symbol = tnode.getSymbol();if ( symbol.getType()==ttype ) {j++;if ( j == i ) {return tnode;}}}}return null;}

public virtual ITerminalNode GetToken(int ttype, int i){if (children == null || i < 0 || i >= children.Count){return null;}int j = -1;foreach (IParseTree o in children){if (o is ITerminalNode){ITerminalNode tnode = (ITerminalNode)o;IToken symbol = tnode.Symbol;if (symbol.Type == ttype){j++;if (j == i){return tnode;}}}}return null;}
