3
accept
ASTNode의 메소드는 무엇입니까 (javadoc가 도움이되지 않았습니다 ...) visit(Expression node)
메서드는 언제 호출됩니까? 여기에 내가 그것을 사용해야하는 방법에 대한 예제 코드입니다 :ASTNode의 accept() 메소드는 무엇을합니까? 그리고 ASTVisitor를 어떻게 사용합니까?
final List<Expression> listi = new ArrayList<Expression>();
String stringi = opi.generate(entryContract, true_false_maybe);
// stringi representes an expression, for example "g!=h".
parser.setSource(stringi.toCharArray());
unit = (CompilationUnit) parser.createAST(null);
ASTNode astRoot = unit.getRoot();
astRoot.accept(new ASTVisitor() {
public boolean visit(Expression node) {
listi.add(node);
return true;
}
});
내가 당신 Expression
클래스는 ASTNode
클래스의 하위 유형 및 ASTVisitor
클래스 존재하는 다른 여행 방법 (추측 당신에게