本文整理汇总了Java中org.walkmod.javalang.ast.expr.ArrayCreationExpr.getArrayCount方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayCreationExpr.getArrayCount方法的具体用法?Java ArrayCreationExpr.getArrayCount怎么用?Java ArrayCreationExpr.getArrayCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.walkmod.javalang.ast.expr.ArrayCreationExpr
的用法示例。
在下文中一共展示了ArrayCreationExpr.getArrayCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.walkmod.javalang.ast.expr.ArrayCreationExpr; //导入方法依赖的package包/类
@Override
public Node visit(ArrayCreationExpr _n, Object _arg) {
Type type_ = cloneNodes(_n.getType(), _arg);
List<Expression> dimensions = visit(_n.getDimensions(), _arg);
ArrayCreationExpr r = new ArrayCreationExpr(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(),
_n.getEndColumn(), type_, dimensions, _n.getArrayCount());
if (_n.getInitializer() != null) {
// ArrayCreationExpr has two mutually
// exclusive constructors
r.setInitializer(cloneNodes(_n.getInitializer(), _arg));
}
List<List<AnnotationExpr>> arraysAnnotations = _n.getArraysAnnotations();
List<List<AnnotationExpr>> _arraysAnnotations = null;
if (arraysAnnotations != null) {
_arraysAnnotations = new LinkedList<List<AnnotationExpr>>();
for (List<AnnotationExpr> aux : arraysAnnotations) {
_arraysAnnotations.add(visit(aux, _arg));
}
}
r.setArraysAnnotations(_arraysAnnotations);
return r;
}
示例2: visit
import org.walkmod.javalang.ast.expr.ArrayCreationExpr; //导入方法依赖的package包/类
public Boolean visit(ArrayCreationExpr n1, Node arg) {
ArrayCreationExpr n2 = (ArrayCreationExpr) arg;
if (n1.getArrayCount() != n2.getArrayCount()) {
return Boolean.FALSE;
}
if (!nodeEquals(n1.getType(), n2.getType())) {
return Boolean.FALSE;
}
if (!nodeEquals(n1.getInitializer(), n2.getInitializer())) {
return Boolean.FALSE;
}
if (!nodesEquals(n1.getDimensions(), n2.getDimensions())) {
return Boolean.FALSE;
}
List<List<AnnotationExpr>> n1a = n1.getArraysAnnotations();
List<List<AnnotationExpr>> n2a = n2.getArraysAnnotations();
if (n1a != null && n2a != null) {
if (n1a.size() != n2a.size()) {
return Boolean.FALSE;
} else {
int i = 0;
for (List<AnnotationExpr> aux : n1a) {
if (!nodesEquals(aux, n2a.get(i))) {
return Boolean.FALSE;
}
i++;
}
}
} else if (n1a != n2a) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
示例3: visit
import org.walkmod.javalang.ast.expr.ArrayCreationExpr; //导入方法依赖的package包/类
public void visit(ArrayCreationExpr n, VisitorContext ctx) {
Object o = ctx.get(NODE_TO_COMPARE_KEY);
if (o != null && o instanceof ArrayCreationExpr) {
ArrayCreationExpr aux = (ArrayCreationExpr) o;
boolean equals = n.getArrayCount() == aux.getArrayCount();
if (!equals) {
applyUpdate(n, (Node) o);
}
boolean backup = isUpdated();
setIsUpdated(false);
Position pos = popPosition();
pushPosition(aux);
inferASTChangesList(n.getArraysAnnotations(), aux.getArraysAnnotations());
inferASTChanges(n.getDimensions(), aux.getDimensions());
inferASTChanges(n.getType(), aux.getType());
popPosition();
pushPosition(pos);
inferASTChanges(n.getInitializer(), aux.getInitializer());
if (!isUpdated()) {
if (equals) {
increaseUnmodifiedNodes(ArrayCreationExpr.class);
} else {
applyUpdate(n, aux, n.getInitializer(), aux.getInitializer());
increaseUpdatedNodes(ArrayCreationExpr.class);
}
} else {
increaseUpdatedNodes(ArrayCreationExpr.class);
}
setIsUpdated(backup || isUpdated());
} else if (o != null) {
setIsUpdated(true);
applyUpdate(n, (Node) o);
}
}