本文整理汇总了Java中com.github.javaparser.ast.stmt.IfStmt.setCondition方法的典型用法代码示例。如果您正苦于以下问题:Java IfStmt.setCondition方法的具体用法?Java IfStmt.setCondition怎么用?Java IfStmt.setCondition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.javaparser.ast.stmt.IfStmt
的用法示例。
在下文中一共展示了IfStmt.setCondition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.github.javaparser.ast.stmt.IfStmt; //导入方法依赖的package包/类
@Override public Node visit(final IfStmt n, final A arg) {
visitComment(n, arg);
final Expression condition = (Expression)
n.getCondition().accept(this, arg);
if (condition == null) {
return null;
}
n.setCondition(condition);
final Statement thenStmt = (Statement) n.getThenStmt().accept(this, arg);
if (thenStmt == null) {
// Remove the entire statement if the then-clause was removed.
// DumpVisitor, used for toString, has no null check for the
// then-clause.
return null;
}
n.setThenStmt(thenStmt);
if (n.getElseStmt() != null) {
n.setElseStmt((Statement) n.getElseStmt().accept(this, arg));
}
return n;
}
示例2: doMerge
import com.github.javaparser.ast.stmt.IfStmt; //导入方法依赖的package包/类
@Override public IfStmt doMerge(IfStmt first, IfStmt second) {
IfStmt is = new IfStmt();
is.setCondition(mergeSingle(first.getCondition(),second.getCondition()));
is.setElseStmt(mergeSingle(first.getElseStmt(),second.getElseStmt()));
is.setThenStmt(mergeSingle(first.getThenStmt(),second.getThenStmt()));
return is;
}
示例3: visit
import com.github.javaparser.ast.stmt.IfStmt; //导入方法依赖的package包/类
@Override public Node visit(final IfStmt n, final A arg) {
n.setCondition((Expression) n.getCondition().accept(this, arg));
n.setThenStmt((Statement) n.getThenStmt().accept(this, arg));
if (n.getElseStmt() != null) {
n.setElseStmt((Statement) n.getElseStmt().accept(this, arg));
}
return n;
}