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

prerna.sablecc2.node.ARoutineConfiguration 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 ARoutineConfiguration extends PConfiguration
{
    private final LinkedList _routine_ = new LinkedList();

    public ARoutineConfiguration()
    {
        // Constructor
    }

    public ARoutineConfiguration(
        @SuppressWarnings("hiding") List _routine_)
    {
        // Constructor
        setRoutine(_routine_);

    }

    @Override
    public Object clone()
    {
        return new ARoutineConfiguration(
            cloneList(this._routine_));
    }

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

    public LinkedList getRoutine()
    {
        return this._routine_;
    }

    public void setRoutine(List list)
    {
        for(PRoutine e : this._routine_)
        {
            e.parent(null);
        }
        this._routine_.clear();

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

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

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

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

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

    @Override
    void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
    {
        // Replace child
        for(ListIterator i = this._routine_.listIterator(); i.hasNext();)
        {
            if(i.next() == oldChild)
            {
                if(newChild != null)
                {
                    i.set((PRoutine) 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