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

soot.jimple.parser.node.AIdentNonvoidType Maven / Gradle / Ivy

/* This file was generated by SableCC (http://www.sablecc.org/). */

package soot.jimple.parser.node;

import java.util.*;
import soot.jimple.parser.analysis.*;

@SuppressWarnings("nls")
public final class AIdentNonvoidType extends PNonvoidType
{
    private TIdentifier _identifier_;
    private final LinkedList _arrayBrackets_ = new LinkedList();

    public AIdentNonvoidType()
    {
        // Constructor
    }

    public AIdentNonvoidType(
        @SuppressWarnings("hiding") TIdentifier _identifier_,
        @SuppressWarnings("hiding") List _arrayBrackets_)
    {
        // Constructor
        setIdentifier(_identifier_);

        setArrayBrackets(_arrayBrackets_);

    }

    @Override
    public Object clone()
    {
        return new AIdentNonvoidType(
            cloneNode(this._identifier_),
            cloneList(this._arrayBrackets_));
    }

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

    public TIdentifier getIdentifier()
    {
        return this._identifier_;
    }

    public void setIdentifier(TIdentifier node)
    {
        if(this._identifier_ != null)
        {
            this._identifier_.parent(null);
        }

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

            node.parent(this);
        }

        this._identifier_ = node;
    }

    public LinkedList getArrayBrackets()
    {
        return this._arrayBrackets_;
    }

    public void setArrayBrackets(List list)
    {
        for(PArrayBrackets e : this._arrayBrackets_)
        {
            e.parent(null);
        }
        this._arrayBrackets_.clear();

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

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

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

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

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

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

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy