Java源码示例:com.github.javaparser.ast.expr.ArrayCreationExpr
示例1
@Override
public void visit(final ArrayCreationExpr n, final Void arg) {
printJavaComment(n.getComment(), arg);
printer.print("new ");
n.getElementType().accept(this, arg);
for (ArrayCreationLevel level : n.getLevels()) {
level.accept(this, arg);
}
if (n.getInitializer().isPresent()) {
printer.print(" ");
n.getInitializer().get().accept(this, arg);
}
}
示例2
@Override public boolean doIsEquals(ArrayCreationExpr first, ArrayCreationExpr second) {
if(!isEqualsUseMerger(first.getType(), second.getType())) return false;
if(first.getArrayCount() != second.getArrayCount()) return false;
if(!isEqualsUseMerger(first.getInitializer(),second.getInitializer())) return false;
if(!isEqualsUseMerger(first.getDimensions(),second.getDimensions())) return false;
return true;
}
示例3
@Override public ArrayCreationExpr doMerge(ArrayCreationExpr first, ArrayCreationExpr second) {
ArrayCreationExpr ace = new ArrayCreationExpr();
ace.setType(mergeSingle(first.getType(),second.getType()));
return ace;
}
示例4
@Override
public void visit(ArrayCreationExpr n, Void arg) {
out.println("ArrayCreationExpr: " + (extended ? n : ""));
super.visit(n, arg);
}