text: 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;}