/* This file was generated by SableCC (http://www.sablecc.org/). */

package soot.jimple.parser.node;

import soot.jimple.parser.analysis.*;

@SuppressWarnings("nls")
public final class AThrowsClause extends PThrowsClause
{
    private TThrows _throws_;
    private PClassNameList _classNameList_;

    public AThrowsClause()
    {
        // Constructor
    }

    public AThrowsClause(
        @SuppressWarnings("hiding") TThrows _throws_,
        @SuppressWarnings("hiding") PClassNameList _classNameList_)
    {
        // Constructor
        setThrows(_throws_);

        setClassNameList(_classNameList_);

    }

    @Override
    public Object clone()
    {
        return new AThrowsClause(
            cloneNode(this._throws_),
            cloneNode(this._classNameList_));
    }

    @Override
    public void apply(Switch sw)
    {
        ((Analysis) sw).caseAThrowsClause(this);
    }

    public TThrows getThrows()
    {
        return this._throws_;
    }

    public void setThrows(TThrows node)
    {
        if(this._throws_ != null)
        {
            this._throws_.parent(null);
        }

        if(node != null)
        {
            if(node.parent() != null)
            {
                node.parent().removeChild(node);
            }

            node.parent(this);
        }

        this._throws_ = node;
    }

    public PClassNameList getClassNameList()
    {
        return this._classNameList_;
    }

    public void setClassNameList(PClassNameList node)
    {
        if(this._classNameList_ != null)
        {
            this._classNameList_.parent(null);
        }

        if(node != null)
        {
            if(node.parent() != null)
            {
                node.parent().removeChild(node);
            }

            node.parent(this);
        }

        this._classNameList_ = node;
    }

    @Override
    public String toString()
    {
        return ""
            + toString(this._throws_)
            + toString(this._classNameList_);
    }

    @Override
    void removeChild(@SuppressWarnings("unused") Node child)
    {
        // Remove child
        if(this._throws_ == child)
        {
            this._throws_ = null;
            return;
        }

        if(this._classNameList_ == child)
        {
            this._classNameList_ = null;
            return;
        }

        throw new RuntimeException("Not a child.");
    }

    @Override
    void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
    {
        // Replace child
        if(this._throws_ == oldChild)
        {
            setThrows((TThrows) newChild);
            return;
        }

        if(this._classNameList_ == oldChild)
        {
            setClassNameList((PClassNameList) newChild);
            return;
        }

        throw new RuntimeException("Not a child.");
    }
}
