/* 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 AUnopExpr extends PUnopExpr
{
    private PUnop _unop_;
    private PImmediate _immediate_;

    public AUnopExpr()
    {
        // Constructor
    }

    public AUnopExpr(
        @SuppressWarnings("hiding") PUnop _unop_,
        @SuppressWarnings("hiding") PImmediate _immediate_)
    {
        // Constructor
        setUnop(_unop_);

        setImmediate(_immediate_);

    }

    @Override
    public Object clone()
    {
        return new AUnopExpr(
            cloneNode(this._unop_),
            cloneNode(this._immediate_));
    }

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

    public PUnop getUnop()
    {
        return this._unop_;
    }

    public void setUnop(PUnop node)
    {
        if(this._unop_ != null)
        {
            this._unop_.parent(null);
        }

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

            node.parent(this);
        }

        this._unop_ = node;
    }

    public PImmediate getImmediate()
    {
        return this._immediate_;
    }

    public void setImmediate(PImmediate node)
    {
        if(this._immediate_ != null)
        {
            this._immediate_.parent(null);
        }

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

            node.parent(this);
        }

        this._immediate_ = node;
    }

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

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

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

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

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

        if(this._immediate_ == oldChild)
        {
            setImmediate((PImmediate) newChild);
            return;
        }

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