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

prerna.sablecc2.node.AMandatoryScriptchain 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 AMandatoryScriptchain extends PMandatoryScriptchain
{
    private PMasterExpr _masterExpr_;
    private final LinkedList _otherscript_ = new LinkedList();

    public AMandatoryScriptchain()
    {
        // Constructor
    }

    public AMandatoryScriptchain(
        @SuppressWarnings("hiding") PMasterExpr _masterExpr_,
        @SuppressWarnings("hiding") List _otherscript_)
    {
        // Constructor
        setMasterExpr(_masterExpr_);

        setOtherscript(_otherscript_);

    }

    @Override
    public Object clone()
    {
        return new AMandatoryScriptchain(
            cloneNode(this._masterExpr_),
            cloneList(this._otherscript_));
    }

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

    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 getOtherscript()
    {
        return this._otherscript_;
    }

    public void setOtherscript(List list)
    {
        for(POtherscript e : this._otherscript_)
        {
            e.parent(null);
        }
        this._otherscript_.clear();

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

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

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

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

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

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

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy