public List<TerminalNode> getTokens(int ttype) {if ( children==null ) {return Collections.emptyList();}List<TerminalNode> tokens = null;for (ParseTree o : children) {if ( o instanceof TerminalNode ) {TerminalNode tnode = (TerminalNode)o;Token symbol = tnode.getSymbol();if ( symbol.getType()==ttype ) {if ( tokens==null ) {tokens = new ArrayList<TerminalNode>();}tokens.add(tnode);}}}if ( tokens==null ) {return Collections.emptyList();}return tokens;}
public virtual ITerminalNode[] GetTokens(int ttype){if (children == null){return Collections.EmptyList<ITerminalNode>();}List<ITerminalNode> tokens = null;foreach (IParseTree o in children){if (o is ITerminalNode){ITerminalNode tnode = (ITerminalNode)o;IToken symbol = tnode.Symbol;if (symbol.Type == ttype){if (tokens == null){tokens = new List<ITerminalNode>();}tokens.Add(tnode);}}}if (tokens == null){return Collections.EmptyList<ITerminalNode>();}return tokens;}