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

prerna.sablecc2.node.AGenRow 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 AGenRow extends PGenRow
{
    private TLBrac _lBrac_;
    private PColDef _colDef_;
    private final LinkedList _othercol_ = new LinkedList();
    private TRBrac _rBrac_;

    public AGenRow()
    {
        // Constructor
    }

    public AGenRow(
        @SuppressWarnings("hiding") TLBrac _lBrac_,
        @SuppressWarnings("hiding") PColDef _colDef_,
        @SuppressWarnings("hiding") List _othercol_,
        @SuppressWarnings("hiding") TRBrac _rBrac_)
    {
        // Constructor
        setLBrac(_lBrac_);

        setColDef(_colDef_);

        setOthercol(_othercol_);

        setRBrac(_rBrac_);

    }

    @Override
    public Object clone()
    {
        return new AGenRow(
            cloneNode(this._lBrac_),
            cloneNode(this._colDef_),
            cloneList(this._othercol_),
            cloneNode(this._rBrac_));
    }

    @Override
    public void apply(Switch sw)
    {
        ((Analysis) sw).caseAGenRow(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 PColDef getColDef()
    {
        return this._colDef_;
    }

    public void setColDef(PColDef node)
    {
        if(this._colDef_ != null)
        {
            this._colDef_.parent(null);
        }

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

            node.parent(this);
        }

        this._colDef_ = node;
    }

    public LinkedList getOthercol()
    {
        return this._othercol_;
    }

    public void setOthercol(List list)
    {
        for(POthercol e : this._othercol_)
        {
            e.parent(null);
        }
        this._othercol_.clear();

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

            e.parent(this);
            this._othercol_.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._colDef_)
            + toString(this._othercol_)
            + toString(this._rBrac_);
    }

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

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

        if(this._othercol_.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._colDef_ == oldChild)
        {
            setColDef((PColDef) newChild);
            return;
        }

        for(ListIterator i = this._othercol_.listIterator(); i.hasNext();)
        {
            if(i.next() == oldChild)
            {
                if(newChild != null)
                {
                    i.set((POthercol) 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