/* 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 ATokenDef extends PTokenDef
{
    private PStateList _stateList_;
    private TId _id_;
    private PRegExp _regExp_;
    private TSlash _slash_;
    private PRegExp _lookAhead_;

    public ATokenDef()
    {
        // Constructor
    }

    public ATokenDef(
        @SuppressWarnings("hiding") PStateList _stateList_,
        @SuppressWarnings("hiding") TId _id_,
        @SuppressWarnings("hiding") PRegExp _regExp_,
        @SuppressWarnings("hiding") TSlash _slash_,
        @SuppressWarnings("hiding") PRegExp _lookAhead_)
    {
        // Constructor
        setStateList(_stateList_);

        setId(_id_);

        setRegExp(_regExp_);

        setSlash(_slash_);

        setLookAhead(_lookAhead_);

    }

    @Override
    public Object clone()
    {
        return new ATokenDef(
            cloneNode(this._stateList_),
            cloneNode(this._id_),
            cloneNode(this._regExp_),
            cloneNode(this._slash_),
            cloneNode(this._lookAhead_));
    }

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

    public PStateList getStateList()
    {
        return this._stateList_;
    }

    public void setStateList(PStateList node)
    {
        if(this._stateList_ != null)
        {
            this._stateList_.parent(null);
        }

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

            node.parent(this);
        }

        this._stateList_ = node;
    }

    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 PRegExp getRegExp()
    {
        return this._regExp_;
    }

    public void setRegExp(PRegExp node)
    {
        if(this._regExp_ != null)
        {
            this._regExp_.parent(null);
        }

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

            node.parent(this);
        }

        this._regExp_ = node;
    }

    public TSlash getSlash()
    {
        return this._slash_;
    }

    public void setSlash(TSlash node)
    {
        if(this._slash_ != null)
        {
            this._slash_.parent(null);
        }

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

            node.parent(this);
        }

        this._slash_ = node;
    }

    public PRegExp getLookAhead()
    {
        return this._lookAhead_;
    }

    public void setLookAhead(PRegExp node)
    {
        if(this._lookAhead_ != null)
        {
            this._lookAhead_.parent(null);
        }

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

            node.parent(this);
        }

        this._lookAhead_ = node;
    }

    @Override
    public String toString()
    {
        return ""
            + toString(this._stateList_)
            + toString(this._id_)
            + toString(this._regExp_)
            + toString(this._slash_)
            + toString(this._lookAhead_);
    }

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

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

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

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

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

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

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

        if(this._id_ == oldChild)
        {
            setId((TId) newChild);
            return;
        }

        if(this._regExp_ == oldChild)
        {
            setRegExp((PRegExp) newChild);
            return;
        }

        if(this._slash_ == oldChild)
        {
            setSlash((TSlash) newChild);
            return;
        }

        if(this._lookAhead_ == oldChild)
        {
            setLookAhead((PRegExp) newChild);
            return;
        }

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