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

package ast.node;

import ast.visitor.*;

@SuppressWarnings("nls")
public final class MainClass extends Node
{
    private String _name_;
    private String _param_;
    private IStatement _statement_;

    public MainClass(int _line_, int _pos_, 
            String _name_, String _param_, IStatement _statement_)
    {
        super(_line_, _pos_);
        
        setName(_name_);

        setParam(_param_);

        setStatement(_statement_);

    }

    @Override
    public int getNumExpChildren() { return 0; }
    
    @Override
    public Object clone()
    {
        return new MainClass(
                this.getLine(),
                this.getPos(),
                this._name_,
                this._param_,
                cloneNode(this._statement_));
    }

    public void accept(Visitor v)
    {
        v.visitMainClass(this);
    }

    public String getName()
    {
        return this._name_;
    }

    public void setName(String name)
    {
        this._name_ = name;
    }

    public String getParam()
    {
        return this._param_;
    }

    public void setParam(String param)
    {
        this._param_ = param;
    }

    public IStatement getStatement()
    {
        return this._statement_;
    }

    public void setStatement(IStatement node)
    {
        if(this._statement_ != null)
        {
            this._statement_.parent(null);
        }

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

            node.parent(this);
        }

        this._statement_ = node;
    }

    @Override
    void removeChild(Node child)
    {

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

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

    @Override
    void replaceChild(Node oldChild, Node newChild)
    {
        if(this._statement_ == oldChild)
        {
            setStatement((IStatement) newChild);
            return;
        }

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