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

prerna.sablecc2.node.AOperation 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 AOperation extends POperation
{
    private TId _id_;
    private TLPar _lPar_;
    private POpInput _opInput_;
    private final LinkedList _otherOpInput_ = new LinkedList();
    private TRPar _rPar_;
    private PAsop _asop_;

    public AOperation()
    {
        // Constructor
    }

    public AOperation(
        @SuppressWarnings("hiding") TId _id_,
        @SuppressWarnings("hiding") TLPar _lPar_,
        @SuppressWarnings("hiding") POpInput _opInput_,
        @SuppressWarnings("hiding") List _otherOpInput_,
        @SuppressWarnings("hiding") TRPar _rPar_,
        @SuppressWarnings("hiding") PAsop _asop_)
    {
        // Constructor
        setId(_id_);

        setLPar(_lPar_);

        setOpInput(_opInput_);

        setOtherOpInput(_otherOpInput_);

        setRPar(_rPar_);

        setAsop(_asop_);

    }

    @Override
    public Object clone()
    {
        return new AOperation(
            cloneNode(this._id_),
            cloneNode(this._lPar_),
            cloneNode(this._opInput_),
            cloneList(this._otherOpInput_),
            cloneNode(this._rPar_),
            cloneNode(this._asop_));
    }

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

    public TId getId()
    {
        return this._id_;
    }

    public void setId(TId node)
    {
        if(this._id_ != null)
        {
            this._id_.parent(null);
        }

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

            node.parent(this);
        }

        this._id_ = node;
    }

    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 POpInput getOpInput()
    {
        return this._opInput_;
    }

    public void setOpInput(POpInput node)
    {
        if(this._opInput_ != null)
        {
            this._opInput_.parent(null);
        }

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

            node.parent(this);
        }

        this._opInput_ = node;
    }

    public LinkedList getOtherOpInput()
    {
        return this._otherOpInput_;
    }

    public void setOtherOpInput(List list)
    {
        for(POtherOpInput e : this._otherOpInput_)
        {
            e.parent(null);
        }
        this._otherOpInput_.clear();

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

            e.parent(this);
            this._otherOpInput_.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;
    }

    public PAsop getAsop()
    {
        return this._asop_;
    }

    public void setAsop(PAsop node)
    {
        if(this._asop_ != null)
        {
            this._asop_.parent(null);
        }

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

            node.parent(this);
        }

        this._asop_ = node;
    }

    @Override
    public String toString()
    {
        return ""
            + toString(this._id_)
            + toString(this._lPar_)
            + toString(this._opInput_)
            + toString(this._otherOpInput_)
            + toString(this._rPar_)
            + toString(this._asop_);
    }

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

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

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

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

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

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

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

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

        if(this._lPar_ == oldChild)
        {
            setLPar((TLPar) newChild);
            return;
        }

        if(this._opInput_ == oldChild)
        {
            setOpInput((POpInput) newChild);
            return;
        }

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

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

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

        if(this._asop_ == oldChild)
        {
            setAsop((PAsop) newChild);
            return;
        }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy