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

package MONAViewer.monalanguage.node;

import java.util.*;
import MONAViewer.monalanguage.analysis.*;

public final class ABiimplExp extends PExp
{
    private PExp _l_;
    private PExp _r_;

    public ABiimplExp ()
    {
    }

    public ABiimplExp (
            PExp _l_,
            PExp _r_
    )
    {
        setL (_l_);
        setR (_r_);
    }

    public Object clone()
    {
        return new ABiimplExp (
            (PExp)cloneNode (_l_),
            (PExp)cloneNode (_r_)
        );
    }

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

    public PExp getL ()
    {
        return _l_;
    }

    public void setL (PExp node)
    {
        if(_l_ != null)
        {
            _l_.parent(null);
        }

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

            node.parent(this);
        }

        _l_ = node;
    }
    public PExp getR ()
    {
        return _r_;
    }

    public void setR (PExp node)
    {
        if(_r_ != null)
        {
            _r_.parent(null);
        }

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

            node.parent(this);
        }

        _r_ = node;
    }

    public String toString()
    {
        return ""
            + toString (_l_)
            + toString (_r_)
        ;
    }

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

    void replaceChild(Node oldChild, Node newChild)
    {
        if ( _l_ == oldChild )
        {
            setL ((PExp) newChild);
            return;
        }
        if ( _r_ == oldChild )
        {
            setR ((PExp) newChild);
            return;
        }
    }

}
