当前位置: 首页>>代码示例>>Java>>正文


Java IfStmt类代码示例

本文整理汇总了Java中org.walkmod.javalang.ast.stmt.IfStmt的典型用法代码示例。如果您正苦于以下问题:Java IfStmt类的具体用法?Java IfStmt怎么用?Java IfStmt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IfStmt类属于org.walkmod.javalang.ast.stmt包,在下文中一共展示了IfStmt类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: visit

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
public void visit(IfStmt n, VisitorContext ctx) {
    Object o = ctx.get(NODE_TO_COMPARE_KEY);
    if (o != null && o instanceof IfStmt) {
        IfStmt aux = (IfStmt) o;
        boolean backup = isUpdated();
        setIsUpdated(false);
        inferASTChanges(n.getCondition(), aux.getCondition());
        inferASTChanges(n.getThenStmt(), aux.getThenStmt());
        inferASTChanges(n.getElseStmt(), aux.getElseStmt());
        if (!isUpdated()) {
            increaseUnmodifiedNodes(IfStmt.class);
        } else {

            increaseUpdatedNodes(IfStmt.class);
        }
        setIsUpdated(backup || isUpdated());
    } else if (o != null) {
        setIsUpdated(true);
        applyUpdate(n, (Node) o);
    }
}
 
开发者ID:walkmod,项目名称:walkmod-javalang-plugin,代码行数:22,代码来源:ChangeLogVisitor.java


示例2: visit

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
@Override
public void visit(IfStmt n, A arg) {
    n.getCondition().accept(expressionTypeAnalyzer, arg);
    n.getThenStmt().accept(this, arg);
    SymbolData symData = n.getThenStmt().getSymbolData();
    n.setSymbolData(symData);
    if (n.getElseStmt() != null) {
        n.getElseStmt().accept(this, arg);
        if (symData != null) {
            symData = symData.merge(n.getElseStmt().getSymbolData());
        }
        n.setSymbolData(symData);
    }

}
 
开发者ID:rpau,项目名称:javalang-compiler,代码行数:16,代码来源:SymbolVisitorAdapter.java


示例3: isDisabledCode

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
static boolean isDisabledCode(ObjectCreationExpr n) {
    Node child = n;
    Node node = child.getParentNode();
    while (node != null) {
        if (node instanceof IfStmt) {
            IfStmt ifs = (IfStmt) node;
            if (child == ifs.getThenStmt() && isCompilationDisabledCondition(ifs.getCondition())) {
                return true;
            }
        }
        child = node;
        node = child.getParentNode();
    }
    return false;
}
 
开发者ID:rpau,项目名称:javalang-compiler,代码行数:16,代码来源:ConditionalCompilationUtil.java


示例4: visit

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
public R visit(IfStmt n, A arg) {
    n.getCondition().accept(this, arg);
    n.getThenStmt().accept(this, arg);
    if (n.getElseStmt() != null) {
        n.getElseStmt().accept(this, arg);
    }
    return null;
}
 
开发者ID:rpau,项目名称:javalang,代码行数:9,代码来源:GenericVisitorAdapter.java


示例5: visit

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
public Boolean visit(IfStmt n1, Node arg) {
    IfStmt n2 = (IfStmt) arg;
    if (!nodeEquals(n1.getCondition(), n2.getCondition())) {
        return Boolean.FALSE;
    }
    if (!nodeEquals(n1.getThenStmt(), n2.getThenStmt())) {
        return Boolean.FALSE;
    }
    if (!nodeEquals(n1.getElseStmt(), n2.getElseStmt())) {
        return Boolean.FALSE;
    }
    return Boolean.TRUE;
}
 
开发者ID:rpau,项目名称:javalang,代码行数:14,代码来源:EqualsVisitor.java


示例6: visit

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
@Override
public Node visit(IfStmt _n, Object _arg) {
    Expression condition = cloneNodes(_n.getCondition(), _arg);
    Statement thenStmt = cloneNodes(_n.getThenStmt(), _arg);
    Statement elseStmt = cloneNodes(_n.getElseStmt(), _arg);
    IfStmt r = new IfStmt(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), condition,
            thenStmt, elseStmt);
    return r;
}
 
开发者ID:rpau,项目名称:javalang,代码行数:10,代码来源:CloneVisitor.java


示例7: visit

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
public void visit(IfStmt n, Object arg) {
    prepareComments(n);
    printPreviousComments(n, arg);
    printer.print("if (");
    n.getCondition().accept(this, arg);
    printer.print(") ");
    Statement thenStmt = n.getThenStmt();
    thenStmt.accept(this, arg);

    Statement elseStmt = n.getElseStmt();
    if (elseStmt != null) {
        if (!thenStmt.isNewNode() && !elseStmt.isNewNode()) {
            int start = thenStmt.getEndLine();
            int end = elseStmt.getBeginLine();

            for (int i = start; i < end; i++) {
                printer.printLn();
            }
            if (start == end) {
                printer.print(" else ");
            } else {
                printer.print("else ");
            }
        } else {
            printer.print(" else ");
        }
        elseStmt.accept(this, arg);
    }
}
 
开发者ID:rpau,项目名称:javalang,代码行数:30,代码来源:DumpVisitor.java


示例8: visit

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
public void visit(IfStmt n, A arg) {
    n.getCondition().accept(this, arg);
    n.getThenStmt().accept(this, arg);
    if (n.getElseStmt() != null) {
        n.getElseStmt().accept(this, arg);
    }
}
 
开发者ID:rpau,项目名称:javalang,代码行数:8,代码来源:VoidVisitorAdapter.java


示例9: visit

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
public void visit(IfStmt n, VisitorContext arg) {
    if (preVisitor != null) {
        preVisitor.visit(n, arg);
    }
    super.visit(n, arg);
    if (postVisitor != null) {
        postVisitor.visit(n, arg);
    }
}
 
开发者ID:rpau,项目名称:javalang,代码行数:10,代码来源:CompositeVisitor.java


示例10: visit

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
public Node visit(IfStmt n, 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;
}
 
开发者ID:rpau,项目名称:javalang,代码行数:9,代码来源:ModifierVisitorAdapter.java


示例11: IfStatement

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
final public IfStmt IfStatement() throws ParseException {
    Expression condition;
    Statement thenStmt;
    Statement elseStmt = null;
    int line;
    int column;
    jj_consume_token(IF);
    line = token.beginLine;
    column = token.beginColumn;
    jj_consume_token(LPAREN);
    condition = Expression();
    jj_consume_token(RPAREN);
    thenStmt = Statement();
    switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
        case ELSE:
            jj_consume_token(ELSE);
            elseStmt = Statement();
            break;
        default:
            jj_la1[151] = jj_gen;;
    }
    {
        if (true)
            return new IfStmt(line, column, token.endLine, token.endColumn, condition, thenStmt, elseStmt);
    }
    throw new Error("Missing return statement in function");
}
 
开发者ID:rpau,项目名称:javalang,代码行数:28,代码来源:ASTParser.java


示例12: assertThat

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
public static IfStmtAssert assertThat(IfStmt actual) {
    return new IfStmtAssert(actual);
}
 
开发者ID:rpau,项目名称:javalang-compiler,代码行数:4,代码来源:AstAssertions.java


示例13: asIfStmt

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
public IfStmtAssert asIfStmt() {
    return AstAssertions.assertThat(asInstanceOf(IfStmt.class))
            .as(navigationDescription("(IfStmt)"));
}
 
开发者ID:rpau,项目名称:javalang-compiler,代码行数:5,代码来源:AbstractStatementAssert.java


示例14: IfStmtAssert

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
IfStmtAssert(IfStmt actual) {
    super(actual, IfStmtAssert.class);
}
 
开发者ID:rpau,项目名称:javalang-compiler,代码行数:4,代码来源:IfStmtAssert.java


示例15: visit

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
public R visit(IfStmt n, A arg); 
开发者ID:rpau,项目名称:javalang,代码行数:2,代码来源:GenericVisitor.java


示例16: visit

import org.walkmod.javalang.ast.stmt.IfStmt; //导入依赖的package包/类
public void visit(IfStmt n, A arg); 
开发者ID:rpau,项目名称:javalang,代码行数:2,代码来源:VoidVisitor.java



注:本文中的org.walkmod.javalang.ast.stmt.IfStmt类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。