/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * This file is part of SableCC.                             *
 * See the file "LICENSE" for copyright information and the  *
 * terms and conditions for copying, distribution and        *
 * modification of SableCC.                                  *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

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

package $0$;


$

Macro:AlternativeHeaderList
import java.util.*;

$

Macro:AlternativeHeader2
import $0$.*;

@SuppressWarnings("nls")
public final class $1$ extends $2$
{

$

Macro:NodeElement
    private $0$ _$1$_;

$

Macro:ListElement
    private final LinkedList<$0$> _$1$_ = new LinkedList<$0$>();

$

Macro:ConstructorHeader

    public $0$(
$

Macro:ConstructorHeaderDeclNode

        @SuppressWarnings("hiding") $0$ _$1$_$2$
$

Macro:ConstructorHeaderDeclList

        @SuppressWarnings("hiding") List<?> _$1$_$2$
$

Macro:ConstructorBodyHeader
)
    {
        // Constructor

$

Macro:ConstructorBodyNode
        set$0$(_$1$_);


$

Macro:ConstructorBodyList
        set$0$(_$1$_);


$

Macro:ConstructorBodyTail
    }

$

Macro:CloneHeader

    @Override
    public Object clone()
    {
        return new $0$(
$

Macro:CloneBodyNode

            cloneNode(this._$1$_)$2$
$

Macro:CloneBodyList

            cloneList(this._$0$_)$1$
$

Macro:CloneTail
);
    }

$

Macro:Apply

    @Override
    public void apply(Switch sw)
    {
        ((Analysis) sw).case$0$(this);
    }

$

Macro:GetSetNode

    public $0$ get$1$()
    {
        return this._$2$_;
    }

    public void set$1$($0$ node)
    {
        if(this._$2$_ != null)
        {
            this._$2$_.parent(null);
        }

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

            node.parent(this);
        }

        this._$2$_ = node;
    }

$

Macro:GetSetList

    public LinkedList<$2$> get$0$()
    {
        return this._$1$_;
    }

    public void set$0$(List<?> list)
    {
        for($2$ e : this._$1$_)
        {
            e.parent(null);
        }
        this._$1$_.clear();

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

            e.parent(this);
            this._$1$_.add(e);
        }
    }

$

Macro:ToStringHeader

    @Override
    public String toString()
    {
        return ""
$

Macro:ToStringBodyNode

            + toString(this._$0$_)
$

Macro:ToStringBodyList

            + toString(this._$0$_)
$

Macro:ToStringTail
;
    }

$

Macro:RemoveChildHeader

    @Override
    void removeChild(@SuppressWarnings("unused") Node child)
    {
        // Remove child

$

Macro:RemoveChildNode
        if(this._$0$_ == child)
        {
            this._$0$_ = null;
            return;
        }


$

Macro:RemoveChildList
        if(this._$0$_.remove(child))
        {
            return;
        }


$

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

$

Macro:ReplaceChildHeader

    @Override
    void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
    {
        // Replace child

$

Macro:ReplaceChildNode
        if(this._$0$_ == oldChild)
        {
            set$1$(($2$) newChild);
            return;
        }


$

Macro:ReplaceChildList
        for(ListIterator<$1$> i = this._$0$_.listIterator(); i.hasNext();)
        {
            if(i.next() == oldChild)
            {
                if(newChild != null)
                {
                    i.set(($1$) newChild);
                    newChild.parent(this);
                    oldChild.parent(null);
                    return;
                }

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


$

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

$

Macro:AlternativeTail
}

$
