/**
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
 */
/* Generated By:JJTree: Do not edit this line. ASTAllocationExpression.java */

package net.sourceforge.pmd.lang.java.ast;

import net.sourceforge.pmd.lang.java.qname.JavaTypeQualifiedName;


public class ASTAllocationExpression extends AbstractJavaTypeNode implements JavaQualifiableNode {

    private JavaTypeQualifiedName qualifiedName;

    public ASTAllocationExpression(int id) {
        super(id);
    }

    public ASTAllocationExpression(JavaParser p, int id) {
        super(p, id);
    }

    /**
     * Accept the visitor. *
     */
    public Object jjtAccept(JavaParserVisitor visitor, Object data) {
        return visitor.visit(this, data);
    }

    /**
     * Returns true if this expression defines a body,
     * which is compiled to an anonymous class. If this
     * method returns false, then {@link #getQualifiedName()}
     * returns {@code null}.
     */
    public boolean isAnonymousClass() {
        if (jjtGetNumChildren() > 1) {
            // check the last child
            return jjtGetChild(jjtGetNumChildren() - 1) instanceof ASTClassOrInterfaceBody;
        }
        return false;
    }

    /**
     * Gets the qualified name of the anonymous class
     * declared by this node, or null if this node
     * doesn't declare any.
     *
     * @see #isAnonymousClass()
     */
    public JavaTypeQualifiedName getQualifiedName() {
        return qualifiedName;
    }

    public void setQualifiedName(JavaTypeQualifiedName qname) {
        this.qualifiedName = qname;
    }

}
