Java源码示例:com.github.javaparser.ast.expr.ConditionalExpr

示例1
@Override
public Expression getMultiInstance(String fieldName) {
    return new ConditionalExpr(
            new BinaryExpr(new NameExpr(fieldName), new NullLiteralExpr(), BinaryExpr.Operator.NOT_EQUALS),
            new NameExpr(fieldName),
            new MethodCallExpr(new TypeExpr(new ClassOrInterfaceType(null, Collections.class.getCanonicalName())), "emptyList")
    );
}
 
示例2
@Override
public void visit(final ConditionalExpr n, final Void arg) {
    printJavaComment(n.getComment(), arg);
    n.getCondition().accept(this, arg);
    printer.print(" ? ");
    n.getThenExpr().accept(this, arg);
    printer.print(" : ");
    n.getElseExpr().accept(this, arg);
}
 
示例3
@Override
public void visit(ConditionalExpr n, Void arg) {

    super.visit(n, arg);
    if (currentMethod != null) {
        conditionCount++;
    }
}
 
示例4
@Override public ConditionalExpr doMerge(ConditionalExpr first, ConditionalExpr second) {
  ConditionalExpr ce = new ConditionalExpr();

  ce.setCondition(mergeSingle(first.getCondition(),second.getCondition()));
  ce.setElseExpr(mergeSingle(first.getElseExpr(),second.getElseExpr()));
  ce.setThenExpr(mergeSingle(first.getThenExpr(),second.getThenExpr()));

  return ce;
}
 
示例5
@Override public boolean doIsEquals(ConditionalExpr first, ConditionalExpr second) {

    if(!isEqualsUseMerger(first.getCondition(),second.getCondition())) return false;
    if(!isEqualsUseMerger(first.getElseExpr(), second.getElseExpr())) return false;
    if(!isEqualsUseMerger(first.getThenExpr(),second.getThenExpr())) return false;

    return true;
  }
 
示例6
@Override
public void visit(ConditionalExpr stmt, Void args) {
    if (!isValid) {
        return;
    }
    messages.add("Test contains an invalid statement: " + stmt.toString());
    isValid = false;
}
 
示例7
@Override
public void visit(ConditionalExpr n, Void arg) {
    out.println("ConditionalExpr: " + (extended ? n : ""));
    super.visit(n, arg);
}