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

package org.sablecc.sablecc.node;

import org.sablecc.sablecc.analysis.*;

@SuppressWarnings("nls")
public final class AProdName extends PProdName
{
    private TId _id_;
    private TId _prodNameTail_;

    public AProdName()
    {
        // Constructor
    }

    public AProdName(
        @SuppressWarnings("hiding") TId _id_,
        @SuppressWarnings("hiding") TId _prodNameTail_)
    {
        // Constructor
        setId(_id_);

        setProdNameTail(_prodNameTail_);

    }

    @Override
    public Object clone()
    {
        return new AProdName(
            cloneNode(this._id_),
            cloneNode(this._prodNameTail_));
    }

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

    public TId getId()
    {
        return this._id_;
    }

    public void setId(TId node)
    {
        if(this._id_ != null)
        {
            this._id_.parent(null);
        }

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

            node.parent(this);
        }

        this._id_ = node;
    }

    public TId getProdNameTail()
    {
        return this._prodNameTail_;
    }

    public void setProdNameTail(TId node)
    {
        if(this._prodNameTail_ != null)
        {
            this._prodNameTail_.parent(null);
        }

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

            node.parent(this);
        }

        this._prodNameTail_ = node;
    }

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

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

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

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

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

        if(this._prodNameTail_ == oldChild)
        {
            setProdNameTail((TId) newChild);
            return;
        }

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