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

package wolf.node;

import wolf.analysis.*;

@SuppressWarnings("nls")
public final class ASingleDefDefList extends PDefList
{
    private PDefHeader _defHeader_;

    public ASingleDefDefList()
    {
        // Constructor
    }

    public ASingleDefDefList(
        @SuppressWarnings("hiding") PDefHeader _defHeader_)
    {
        // Constructor
        setDefHeader(_defHeader_);

    }

    @Override
    public Object clone()
    {
        return new ASingleDefDefList(
            cloneNode(this._defHeader_));
    }

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

    public PDefHeader getDefHeader()
    {
        return this._defHeader_;
    }

    public void setDefHeader(PDefHeader node)
    {
        if(this._defHeader_ != null)
        {
            this._defHeader_.parent(null);
        }

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

            node.parent(this);
        }

        this._defHeader_ = node;
    }

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

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

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

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

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