本文整理汇总了Java中com.github.javaparser.ast.stmt.Statement.accept方法的典型用法代码示例。如果您正苦于以下问题:Java Statement.accept方法的具体用法?Java Statement.accept怎么用?Java Statement.accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.javaparser.ast.stmt.Statement
的用法示例。
在下文中一共展示了Statement.accept方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.github.javaparser.ast.stmt.Statement; //导入方法依赖的package包/类
@Override
public void visit(final BlockStmt n, final Object arg) {
printer.printLn("BlockStmt");
printOrphanCommentsBeforeThisChildNode(n);
printJavaComment(n.getComment(), arg);
printer.printLn("{");
if (n.getStmts() != null) {
printer.indent();
for (final Statement s : n.getStmts()) {
s.accept(this, arg);
printer.printLn();
}
printer.unindent();
}
printer.print("}");
}
示例2: visit
import com.github.javaparser.ast.stmt.Statement; //导入方法依赖的package包/类
@Override
public Node visit(final BlockStmt n, final Object arg) {
if (n.getStmts() != null) {
Vector<Statement> lnewlist = new Vector<Statement>();
for (final Statement s : n.getStmts()) {
Statement mystmt = (Statement) s.accept(this, arg);
// Append the expanded list to list of Statements
if (mystmt instanceof ListExpressionStmt) {
lnewlist.addAll(((ListExpressionStmt) mystmt).getVarStmts());
} else {
lnewlist.add(mystmt);
}
}
n.setStmts(lnewlist);
}
return n;
}
示例3: visit
import com.github.javaparser.ast.stmt.Statement; //导入方法依赖的package包/类
@Override public void visit(final BlockStmt n, final Object arg) {
printOrphanCommentsBeforeThisChildNode(n);
printJavaComment(n.getComment(), arg);
printer.printLn("{");
if (n.getStmts() != null) {
printer.indent();
for (final Statement s : n.getStmts()) {
s.accept(this, arg);
printer.printLn();
}
printer.unindent();
}
printOrphanCommentsEnding(n);
printer.print("}");
}
示例4: visit
import com.github.javaparser.ast.stmt.Statement; //导入方法依赖的package包/类
@Override public void visit(final BlockStmt n, final Object arg) {
printOrphanCommentsBeforeThisChildNode(n);
printJavaComment(n.getComment(), arg);
printer.printLn("{");
if (n.getStmts() != null) {
printer.indent();
for (final Statement s : n.getStmts()) {
s.accept(this, arg);
printer.printLn();
}
printer.unindent();
}
printOrphanCommentsEnding(n);
printer.print("}");
}
示例5: visit
import com.github.javaparser.ast.stmt.Statement; //导入方法依赖的package包/类
@Override
public void visit(final SwitchEntryStmt n, final Void arg) {
printJavaComment(n.getComment(), arg);
if (n.getLabel().isPresent()) {
printer.print("case ");
n.getLabel().get().accept(this, arg);
printer.print(":");
} else {
printer.print("default:");
}
if (n.getStatements() != null
&& n.getStatements().size() == 1
&& n.getStatements().get(0) instanceof BlockStmt) {
printer.print(" ");
n.getStatements().get(0).accept(this, arg);
printer.println();
} else {
printer.println();
if (n.getStatements() != null) {
printer.indent();
for (final Statement s : n.getStatements()) {
s.accept(this, arg);
printer.println();
}
printer.unindent();
}
}
}
示例6: visit
import com.github.javaparser.ast.stmt.Statement; //导入方法依赖的package包/类
@Override
public R visit(final BlockStmt n, final A arg) {
if (n.getStmts() != null) {
for (final Statement s : n.getStmts()) {
{
R result = s.accept(this, arg);
if (result != null) {
return result;
}
}
}
}
return null;
}
示例7: visit
import com.github.javaparser.ast.stmt.Statement; //导入方法依赖的package包/类
@Override public void visit(final BlockStmt n, final A arg) {
visitComment(n.getComment(), arg);
if (n.getStmts() != null) {
for (final Statement s : n.getStmts()) {
s.accept(this, arg);
}
}
}
示例8: visit
import com.github.javaparser.ast.stmt.Statement; //导入方法依赖的package包/类
@Override public void visit(final BlockStmt n, final A arg) {
jw.write(n);
visitComment(n.getComment(), arg);
if (n.getStmts() != null) {
for (final Statement s : n.getStmts()) {
s.accept(this, arg);
}
}
}