/* 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 ACastExpression extends PExpression
{
    private TLParen _lParen_;
    private PNonvoidType _nonvoidType_;
    private TRParen _rParen_;
    private PImmediate _immediate_;

    public ACastExpression()
    {
        // Constructor
    }

    public ACastExpression(
        @SuppressWarnings("hiding") TLParen _lParen_,
        @SuppressWarnings("hiding") PNonvoidType _nonvoidType_,
        @SuppressWarnings("hiding") TRParen _rParen_,
        @SuppressWarnings("hiding") PImmediate _immediate_)
    {
        // Constructor
        setLParen(_lParen_);

        setNonvoidType(_nonvoidType_);

        setRParen(_rParen_);

        setImmediate(_immediate_);

    }

    @Override
    public Object clone()
    {
        return new ACastExpression(
            cloneNode(this._lParen_),
            cloneNode(this._nonvoidType_),
            cloneNode(this._rParen_),
            cloneNode(this._immediate_));
    }

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

    public TLParen getLParen()
    {
        return this._lParen_;
    }

    public void setLParen(TLParen node)
    {
        if(this._lParen_ != null)
        {
            this._lParen_.parent(null);
        }

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

            node.parent(this);
        }

        this._lParen_ = node;
    }

    public PNonvoidType getNonvoidType()
    {
        return this._nonvoidType_;
    }

    public void setNonvoidType(PNonvoidType node)
    {
        if(this._nonvoidType_ != null)
        {
            this._nonvoidType_.parent(null);
        }

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

            node.parent(this);
        }

        this._nonvoidType_ = node;
    }

    public TRParen getRParen()
    {
        return this._rParen_;
    }

    public void setRParen(TRParen node)
    {
        if(this._rParen_ != null)
        {
            this._rParen_.parent(null);
        }

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

            node.parent(this);
        }

        this._rParen_ = 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._lParen_)
            + toString(this._nonvoidType_)
            + toString(this._rParen_)
            + toString(this._immediate_);
    }

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

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

        if(this._rParen_ == child)
        {
            this._rParen_ = 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._lParen_ == oldChild)
        {
            setLParen((TLParen) newChild);
            return;
        }

        if(this._nonvoidType_ == oldChild)
        {
            setNonvoidType((PNonvoidType) newChild);
            return;
        }

        if(this._rParen_ == oldChild)
        {
            setRParen((TRParen) newChild);
            return;
        }

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

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