All Downloads are FREE. Search and download functionalities are using the official Maven repository.

prerna.sablecc2.node.AList Maven / Gradle / Ivy

There is a newer version: 4.2.2
Show newest version
/* This file was generated by SableCC (http://www.sablecc.org/). */

package prerna.sablecc2.node;

import java.util.*;
import prerna.sablecc2.analysis.*;

@SuppressWarnings("nls")
public final class AList extends PList
{
    private TLPar _lPar_;
    private PMasterExpr _masterExpr_;
    private final LinkedList _otherExpr_ = new LinkedList();
    private TRPar _rPar_;

    public AList()
    {
        // Constructor
    }

    public AList(
        @SuppressWarnings("hiding") TLPar _lPar_,
        @SuppressWarnings("hiding") PMasterExpr _masterExpr_,
        @SuppressWarnings("hiding") List _otherExpr_,
        @SuppressWarnings("hiding") TRPar _rPar_)
    {
        // Constructor
        setLPar(_lPar_);

        setMasterExpr(_masterExpr_);

        setOtherExpr(_otherExpr_);

        setRPar(_rPar_);

    }

    @Override
    public Object clone()
    {
        return new AList(
            cloneNode(this._lPar_),
            cloneNode(this._masterExpr_),
            cloneList(this._otherExpr_),
            cloneNode(this._rPar_));
    }

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

    public TLPar getLPar()
    {
        return this._lPar_;
    }

    public void setLPar(TLPar node)
    {
        if(this._lPar_ != null)
        {
            this._lPar_.parent(null);
        }

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

            node.parent(this);
        }

        this._lPar_ = node;
    }

    public PMasterExpr getMasterExpr()
    {
        return this._masterExpr_;
    }

    public void setMasterExpr(PMasterExpr node)
    {
        if(this._masterExpr_ != null)
        {
            this._masterExpr_.parent(null);
        }

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

            node.parent(this);
        }

        this._masterExpr_ = node;
    }

    public LinkedList getOtherExpr()
    {
        return this._otherExpr_;
    }

    public void setOtherExpr(List list)
    {
        for(POtherExpr e : this._otherExpr_)
        {
            e.parent(null);
        }
        this._otherExpr_.clear();

        for(Object obj_e : list)
        {
            POtherExpr e = (POtherExpr) obj_e;
            if(e.parent() != null)
            {
                e.parent().removeChild(e);
            }

            e.parent(this);
            this._otherExpr_.add(e);
        }
    }

    public TRPar getRPar()
    {
        return this._rPar_;
    }

    public void setRPar(TRPar node)
    {
        if(this._rPar_ != null)
        {
            this._rPar_.parent(null);
        }

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

            node.parent(this);
        }

        this._rPar_ = node;
    }

    @Override
    public String toString()
    {
        return ""
            + toString(this._lPar_)
            + toString(this._masterExpr_)
            + toString(this._otherExpr_)
            + toString(this._rPar_);
    }

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

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

        if(this._otherExpr_.remove(child))
        {
            return;
        }

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

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

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

        if(this._masterExpr_ == oldChild)
        {
            setMasterExpr((PMasterExpr) newChild);
            return;
        }

        for(ListIterator i = this._otherExpr_.listIterator(); i.hasNext();)
        {
            if(i.next() == oldChild)
            {
                if(newChild != null)
                {
                    i.set((POtherExpr) newChild);
                    newChild.parent(this);
                    oldChild.parent(null);
                    return;
                }

                i.remove();
                oldChild.parent(null);
                return;
            }
        }

        if(this._rPar_ == oldChild)
        {
            setRPar((TRPar) newChild);
            return;
        }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy