/* 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 ATransitionEffect extends PTransitionEffect
{
    private TDo _do_;
    private PSimpleBlock _simpleBlock_;

    public ATransitionEffect()
    {
        // Constructor
    }

    public ATransitionEffect(
        @SuppressWarnings("hiding") TDo _do_,
        @SuppressWarnings("hiding") PSimpleBlock _simpleBlock_)
    {
        // Constructor
        setDo(_do_);

        setSimpleBlock(_simpleBlock_);

    }

    @Override
    public Object clone()
    {
        return new ATransitionEffect(
            cloneNode(this._do_),
            cloneNode(this._simpleBlock_));
    }

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

    public TDo getDo()
    {
        return this._do_;
    }

    public void setDo(TDo node)
    {
        if(this._do_ != null)
        {
            this._do_.parent(null);
        }

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

            node.parent(this);
        }

        this._do_ = node;
    }

    public PSimpleBlock getSimpleBlock()
    {
        return this._simpleBlock_;
    }

    public void setSimpleBlock(PSimpleBlock node)
    {
        if(this._simpleBlock_ != null)
        {
            this._simpleBlock_.parent(null);
        }

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

            node.parent(this);
        }

        this._simpleBlock_ = node;
    }

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

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

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

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

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

        if(this._simpleBlock_ == oldChild)
        {
            setSimpleBlock((PSimpleBlock) newChild);
            return;
        }

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