/* * @see ASTVisitor#visit(ConstructorInvocation) */ public boolean visit(ConstructorInvocation node) { if (node.getAST().apiLevel() >= AST.JLS3) { if (!node.typeArguments().isEmpty()) { this.fBuffer.append("<"); // $NON-NLS-1$ for (Iterator it = node.typeArguments().iterator(); it.hasNext(); ) { Type t = (Type) it.next(); t.accept(this); if (it.hasNext()) { this.fBuffer.append(","); // $NON-NLS-1$ } } this.fBuffer.append(">"); // $NON-NLS-1$ } } this.fBuffer.append("this("); // $NON-NLS-1$ for (Iterator it = node.arguments().iterator(); it.hasNext(); ) { Expression e = (Expression) it.next(); e.accept(this); if (it.hasNext()) { this.fBuffer.append(","); // $NON-NLS-1$ } } this.fBuffer.append(");"); // $NON-NLS-1$ return false; }
/* * @see ASTVisitor#visit(FunctionInvocation) */ public boolean visit(FunctionInvocation node) { if (node.getExpression() != null) { node.getExpression().accept(this); this.fBuffer.append("."); // $NON-NLS-1$ } if (node.getAST().apiLevel() >= AST.JLS3) { if (!node.typeArguments().isEmpty()) { this.fBuffer.append("<"); // $NON-NLS-1$ for (Iterator it = node.typeArguments().iterator(); it.hasNext(); ) { Type t = (Type) it.next(); t.accept(this); if (it.hasNext()) { this.fBuffer.append(","); // $NON-NLS-1$ } } this.fBuffer.append(">"); // $NON-NLS-1$ } } SimpleName name = node.getName(); if (name != null) name.accept(this); this.fBuffer.append("("); // $NON-NLS-1$ for (Iterator it = node.arguments().iterator(); it.hasNext(); ) { Expression e = (Expression) it.next(); e.accept(this); if (it.hasNext()) { this.fBuffer.append(","); // $NON-NLS-1$ } } this.fBuffer.append(")"); // $NON-NLS-1$ return false; }
/* * @see ASTVisitor#visit(ArrayCreation) */ public boolean visit(ArrayCreation node) { this.fBuffer.append("new "); // $NON-NLS-1$ ArrayType at = node.getType(); int dims = at.getDimensions(); Type elementType = at.getElementType(); elementType.accept(this); for (Iterator it = node.dimensions().iterator(); it.hasNext(); ) { this.fBuffer.append("["); // $NON-NLS-1$ Expression e = (Expression) it.next(); e.accept(this); this.fBuffer.append("]"); // $NON-NLS-1$ dims--; } // add empty "[]" for each extra array dimension for (int i = 0; i < dims; i++) { this.fBuffer.append("[]"); // $NON-NLS-1$ } if (node.getInitializer() != null) { node.getInitializer().accept(this); } return false; }