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

package uk.co.zonetora.fj.ast.node;

import java.util.*;
import uk.co.zonetora.fj.ast.analysis.*;

public final class ACastTerm extends PTerm
{
    private TLSq _lSq_;
    private TIdentifier _identifier_;
    private TRSq _rSq_;
    private PNonLeftRecTerm _nonLeftRecTerm_;

    public ACastTerm()
    {
    }

    public ACastTerm(
        TLSq _lSq_,
        TIdentifier _identifier_,
        TRSq _rSq_,
        PNonLeftRecTerm _nonLeftRecTerm_)
    {
        setLSq(_lSq_);

        setIdentifier(_identifier_);

        setRSq(_rSq_);

        setNonLeftRecTerm(_nonLeftRecTerm_);

    }
    public Object clone()
    {
        return new ACastTerm(
            (TLSq) cloneNode(_lSq_),
            (TIdentifier) cloneNode(_identifier_),
            (TRSq) cloneNode(_rSq_),
            (PNonLeftRecTerm) cloneNode(_nonLeftRecTerm_));
    }

    public void apply(Switch sw)
    {
        ((Analysis) sw).caseACastTerm(this);
    }

    public TLSq getLSq()
    {
        return _lSq_;
    }

    public void setLSq(TLSq node)
    {
        if(_lSq_ != null)
        {
            _lSq_.parent(null);
        }

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

            node.parent(this);
        }

        _lSq_ = node;
    }

    public TIdentifier getIdentifier()
    {
        return _identifier_;
    }

    public void setIdentifier(TIdentifier node)
    {
        if(_identifier_ != null)
        {
            _identifier_.parent(null);
        }

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

            node.parent(this);
        }

        _identifier_ = node;
    }

    public TRSq getRSq()
    {
        return _rSq_;
    }

    public void setRSq(TRSq node)
    {
        if(_rSq_ != null)
        {
            _rSq_.parent(null);
        }

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

            node.parent(this);
        }

        _rSq_ = node;
    }

    public PNonLeftRecTerm getNonLeftRecTerm()
    {
        return _nonLeftRecTerm_;
    }

    public void setNonLeftRecTerm(PNonLeftRecTerm node)
    {
        if(_nonLeftRecTerm_ != null)
        {
            _nonLeftRecTerm_.parent(null);
        }

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

            node.parent(this);
        }

        _nonLeftRecTerm_ = node;
    }

    public String toString()
    {
        return ""
            + toString(_lSq_)
            + toString(_identifier_)
            + toString(_rSq_)
            + toString(_nonLeftRecTerm_);
    }

    void removeChild(Node child)
    {
        if(_lSq_ == child)
        {
            _lSq_ = null;
            return;
        }

        if(_identifier_ == child)
        {
            _identifier_ = null;
            return;
        }

        if(_rSq_ == child)
        {
            _rSq_ = null;
            return;
        }

        if(_nonLeftRecTerm_ == child)
        {
            _nonLeftRecTerm_ = null;
            return;
        }

    }

    void replaceChild(Node oldChild, Node newChild)
    {
        if(_lSq_ == oldChild)
        {
            setLSq((TLSq) newChild);
            return;
        }

        if(_identifier_ == oldChild)
        {
            setIdentifier((TIdentifier) newChild);
            return;
        }

        if(_rSq_ == oldChild)
        {
            setRSq((TRSq) newChild);
            return;
        }

        if(_nonLeftRecTerm_ == oldChild)
        {
            setNonLeftRecTerm((PNonLeftRecTerm) newChild);
            return;
        }

    }
}
