/* 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 ACaseStmt extends PCaseStmt
{
    private PCaseLabel _caseLabel_;
    private TColon _colon_;
    private PGotoStmt _gotoStmt_;

    public ACaseStmt()
    {
        // Constructor
    }

    public ACaseStmt(
        @SuppressWarnings("hiding") PCaseLabel _caseLabel_,
        @SuppressWarnings("hiding") TColon _colon_,
        @SuppressWarnings("hiding") PGotoStmt _gotoStmt_)
    {
        // Constructor
        setCaseLabel(_caseLabel_);

        setColon(_colon_);

        setGotoStmt(_gotoStmt_);

    }

    @Override
    public Object clone()
    {
        return new ACaseStmt(
            cloneNode(this._caseLabel_),
            cloneNode(this._colon_),
            cloneNode(this._gotoStmt_));
    }

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

    public PCaseLabel getCaseLabel()
    {
        return this._caseLabel_;
    }

    public void setCaseLabel(PCaseLabel node)
    {
        if(this._caseLabel_ != null)
        {
            this._caseLabel_.parent(null);
        }

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

            node.parent(this);
        }

        this._caseLabel_ = node;
    }

    public TColon getColon()
    {
        return this._colon_;
    }

    public void setColon(TColon node)
    {
        if(this._colon_ != null)
        {
            this._colon_.parent(null);
        }

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

            node.parent(this);
        }

        this._colon_ = node;
    }

    public PGotoStmt getGotoStmt()
    {
        return this._gotoStmt_;
    }

    public void setGotoStmt(PGotoStmt node)
    {
        if(this._gotoStmt_ != null)
        {
            this._gotoStmt_.parent(null);
        }

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

            node.parent(this);
        }

        this._gotoStmt_ = node;
    }

    @Override
    public String toString()
    {
        return ""
            + toString(this._caseLabel_)
            + toString(this._colon_)
            + toString(this._gotoStmt_);
    }

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

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

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

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

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

        if(this._colon_ == oldChild)
        {
            setColon((TColon) newChild);
            return;
        }

        if(this._gotoStmt_ == oldChild)
        {
            setGotoStmt((PGotoStmt) newChild);
            return;
        }

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