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

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

The 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 AMapList extends PMapList
{
    private TLBrac _lBrac_;
    private PMapExtendedInput _mapExtendedInput_;
    private final LinkedList _mapListExtend_ = new LinkedList();
    private TRBrac _rBrac_;

    public AMapList()
    {
        // Constructor
    }

    public AMapList(
        @SuppressWarnings("hiding") TLBrac _lBrac_,
        @SuppressWarnings("hiding") PMapExtendedInput _mapExtendedInput_,
        @SuppressWarnings("hiding") List _mapListExtend_,
        @SuppressWarnings("hiding") TRBrac _rBrac_)
    {
        // Constructor
        setLBrac(_lBrac_);

        setMapExtendedInput(_mapExtendedInput_);

        setMapListExtend(_mapListExtend_);

        setRBrac(_rBrac_);

    }

    @Override
    public Object clone()
    {
        return new AMapList(
            cloneNode(this._lBrac_),
            cloneNode(this._mapExtendedInput_),
            cloneList(this._mapListExtend_),
            cloneNode(this._rBrac_));
    }

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

    public TLBrac getLBrac()
    {
        return this._lBrac_;
    }

    public void setLBrac(TLBrac node)
    {
        if(this._lBrac_ != null)
        {
            this._lBrac_.parent(null);
        }

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

            node.parent(this);
        }

        this._lBrac_ = node;
    }

    public PMapExtendedInput getMapExtendedInput()
    {
        return this._mapExtendedInput_;
    }

    public void setMapExtendedInput(PMapExtendedInput node)
    {
        if(this._mapExtendedInput_ != null)
        {
            this._mapExtendedInput_.parent(null);
        }

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

            node.parent(this);
        }

        this._mapExtendedInput_ = node;
    }

    public LinkedList getMapListExtend()
    {
        return this._mapListExtend_;
    }

    public void setMapListExtend(List list)
    {
        for(PMapListExtend e : this._mapListExtend_)
        {
            e.parent(null);
        }
        this._mapListExtend_.clear();

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

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

    public TRBrac getRBrac()
    {
        return this._rBrac_;
    }

    public void setRBrac(TRBrac node)
    {
        if(this._rBrac_ != null)
        {
            this._rBrac_.parent(null);
        }

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

            node.parent(this);
        }

        this._rBrac_ = node;
    }

    @Override
    public String toString()
    {
        return ""
            + toString(this._lBrac_)
            + toString(this._mapExtendedInput_)
            + toString(this._mapListExtend_)
            + toString(this._rBrac_);
    }

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

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

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

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

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

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

        if(this._mapExtendedInput_ == oldChild)
        {
            setMapExtendedInput((PMapExtendedInput) newChild);
            return;
        }

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

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

        if(this._rBrac_ == oldChild)
        {
            setRBrac((TRBrac) newChild);
            return;
        }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy