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

package com.google.clearsilver.jsilver.syntax.node;

import com.google.clearsilver.jsilver.syntax.analysis.*;

@SuppressWarnings("nls")
public final class ADataCommand extends PCommand
{
    private TData _data_;

    public ADataCommand()
    {
        // Constructor
    }

    public ADataCommand(
        @SuppressWarnings("hiding") TData _data_)
    {
        // Constructor
        setData(_data_);

    }

    @Override
    public Object clone()
    {
        return new ADataCommand(
            cloneNode(this._data_));
    }

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

    public TData getData()
    {
        return this._data_;
    }

    public void setData(TData node)
    {
        if(this._data_ != null)
        {
            this._data_.parent(null);
        }

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

            node.parent(this);
        }

        this._data_ = node;
    }

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

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

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

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

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