本文整理汇总了Java中com.github.javaparser.ast.stmt.WhileStmt类的典型用法代码示例。如果您正苦于以下问题:Java WhileStmt类的具体用法?Java WhileStmt怎么用?Java WhileStmt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WhileStmt类属于com.github.javaparser.ast.stmt包,在下文中一共展示了WhileStmt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseWhileStatement
import com.github.javaparser.ast.stmt.WhileStmt; //导入依赖的package包/类
/**
*
* @param ws
* a github javaparser whileStatement
* @param attributes
* the list of attributes of the class,
* to potentially get a type from the name
* @param bd
* a body declaration
* @return
* a LoopStatement structure
*/
private LoopStatement parseWhileStatement(WhileStmt ws, List<Attribute> attributes, BodyDeclaration bd) {
LoopStatement ls = new LoopStatement();
List<Stmt> initialisation = null;
if (ws.getCondition() != null) {
if (ws.getCondition() instanceof AssignExpr) {
initialisation = new ArrayList<>();
initialisation.addAll(parseAssignExpression((AssignExpr) ws.getCondition(), attributes, bd.getBeginLine()));
} else {
ls.setCondition(parseExpression(ws.getCondition(), attributes, bd.getBeginLine()));
}
}
ls.setInitialization(initialisation);
ls.setBody(parseStatement(ws.getBody(), attributes, bd));
ls.setLine(ws.getBeginLine() - bd.getBeginLine());
return ls;
}
示例2: visit
import com.github.javaparser.ast.stmt.WhileStmt; //导入依赖的package包/类
@Override
public void visit(final WhileStmt n, final Void arg) {
if (canAddNewLine(n)) printer.println();
printJavaComment(n.getComment(), arg);
printer.print("while (");
n.getCondition().accept(this, arg);
printer.print(") ");
n.getBody().accept(this, arg);
if (getNext(n) != null) printer.println();
}
示例3: isBlockStmt
import com.github.javaparser.ast.stmt.WhileStmt; //导入依赖的package包/类
private static boolean isBlockStmt(Node n) {
return n instanceof BlockStmt
|| n instanceof DoStmt
|| n instanceof ForStmt
|| n instanceof ForeachStmt
|| n instanceof IfStmt
|| n instanceof SwitchStmt
|| n instanceof TryStmt
|| n instanceof WhileStmt;
}
示例4: visit
import com.github.javaparser.ast.stmt.WhileStmt; //导入依赖的package包/类
@Override
public void visit(final WhileStmt n, final Object arg) {
printer.printLn("WhileStmt");
printJavaComment(n.getComment(), arg);
printer.print("while (");
n.getCondition().accept(this, arg);
printer.print(") ");
n.getBody().accept(this, arg);
}
示例5: visit
import com.github.javaparser.ast.stmt.WhileStmt; //导入依赖的package包/类
@Override
public JCTree visit(final WhileStmt n, final Object arg) {
//ARG0: JCExpression cond
JCExpression arg0 = (JCExpression) n.getCondition().accept(this, arg);
//ARG0: JCStatement body
JCStatement arg1 = (JCStatement) n.getBody().accept(this, arg);
return new AJCWhileLoop(make.WhileLoop(arg0, arg1), ((n.getComment() != null) ? n.getComment().getContent() : null));
}
示例6: visit
import com.github.javaparser.ast.stmt.WhileStmt; //导入依赖的package包/类
@Override public Boolean visit(final WhileStmt n1, final Node arg) {
final WhileStmt n2 = (WhileStmt) arg;
if (!nodeEquals(n1.getCondition(), n2.getCondition())) {
return Boolean.FALSE;
}
if (!nodeEquals(n1.getBody(), n2.getBody())) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
示例7: visit
import com.github.javaparser.ast.stmt.WhileStmt; //导入依赖的package包/类
@Override public void visit(final WhileStmt n, final Object arg) {
printJavaComment(n.getComment(), arg);
printer.print("while (");
n.getCondition().accept(this, arg);
printer.print(") ");
n.getBody().accept(this, arg);
}
示例8: visit
import com.github.javaparser.ast.stmt.WhileStmt; //导入依赖的package包/类
@Override public Boolean visit(final WhileStmt n1, final Node arg) {
final WhileStmt n2 = (WhileStmt) arg;
if (!nodeEquals(n1.getCondition(), n2.getCondition())) {
return false;
}
if (!nodeEquals(n1.getBody(), n2.getBody())) {
return false;
}
return true;
}
示例9: visit
import com.github.javaparser.ast.stmt.WhileStmt; //导入依赖的package包/类
@Override
public Node visit(WhileStmt _n, Object _arg) {
Expression condition = cloneNodes(_n.getCondition(), _arg);
Statement body = cloneNodes(_n.getBody(), _arg);
Comment comment = cloneNodes(_n.getComment(), _arg);
WhileStmt r = new WhileStmt(
_n.getRange(),
condition, body
);
r.setComment(comment);
return r;
}
示例10: visit
import com.github.javaparser.ast.stmt.WhileStmt; //导入依赖的package包/类
@Override public void visit(final WhileStmt n, final Object arg) {
printJavaComment(n.getComment(), arg);
printer.print("while (");
n.getCondition().accept(this, arg);
printer.print(") ");
n.getBody().accept(this, arg);
}
示例11: visit
import com.github.javaparser.ast.stmt.WhileStmt; //导入依赖的package包/类
@Override
public Node visit(
WhileStmt n, Map<Node, Node> arg
) {
if (arg.containsKey(n)) {
return arg.get(n);
}
return super.visit(n, arg);
}
示例12: visit
import com.github.javaparser.ast.stmt.WhileStmt; //导入依赖的package包/类
@Override
public void visit(WhileStmt n, Script arg) {
}
示例13: doMerge
import com.github.javaparser.ast.stmt.WhileStmt; //导入依赖的package包/类
@Override public WhileStmt doMerge(WhileStmt first, WhileStmt second) {
WhileStmt ws = new WhileStmt();
ws.setCondition(mergeSingle(first.getCondition(),second.getCondition()));
ws.setBody(mergeSingle(first.getBody(),second.getBody()));
return ws;
}
示例14: doIsEquals
import com.github.javaparser.ast.stmt.WhileStmt; //导入依赖的package包/类
@Override public boolean doIsEquals(WhileStmt first, WhileStmt second) {
if(!isEqualsUseMerger(first.getCondition(),second.getCondition())) return false;
if(!isEqualsUseMerger(first.getBody(),second.getBody())) return false;
return true;
}
示例15: visit
import com.github.javaparser.ast.stmt.WhileStmt; //导入依赖的package包/类
@Override public void visit(final WhileStmt n, final A arg) {
visitComment(n.getComment(), arg);
n.getCondition().accept(this, arg);
n.getBody().accept(this, arg);
}