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

package com.abstratt.mdd.frontend.textuml.grammar.node;

import com.abstratt.mdd.frontend.textuml.grammar.analysis.*;

@SuppressWarnings("nls")
public final class APackageVisibilityModifier extends PVisibilityModifier
{
    private TPackage _package_;

    public APackageVisibilityModifier()
    {
        // Constructor
    }

    public APackageVisibilityModifier(
        @SuppressWarnings("hiding") TPackage _package_)
    {
        // Constructor
        setPackage(_package_);

    }

    @Override
    public Object clone()
    {
        return new APackageVisibilityModifier(
            cloneNode(this._package_));
    }

    public void apply(Switch sw)
    {
        ((Analysis) sw).caseAPackageVisibilityModifier(this);
    }

    public TPackage getPackage()
    {
        return this._package_;
    }

    public void setPackage(TPackage node)
    {
        if(this._package_ != null)
        {
            this._package_.parent(null);
        }

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

            node.parent(this);
        }

        this._package_ = node;
    }

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

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

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

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

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