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

package ast.node;

import ast.visitor.*;
import java.util.*;

@SuppressWarnings("nls")
public final class Program extends Node
{
    private StatementList _stmts_;

    public Program()
    {
        // Constructor
    }

    public Program(StatementList _stmts_)
    {
        // Constructor
        setStmts(_stmts_);
    }

    @Override
    public Object clone()
    {
        return new Program(cloneNode(this._stmts_));
    }

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

    public StatementList getStmts()
    {
        return this._stmts_;
    }

    public void setStmts(StatementList node)
    {
        if(this._stmts_ != null)
        {
            this._stmts_.parent(null);
        }

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

            node.parent(this);
        }

        this._stmts_ = node;
    }

    @Override
    void removeChild(Node child)
    {
        // Remove child
        if(this._stmts_ == child)
        {
            this._stmts_ = null;
            return;
        }

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

    @Override
    void replaceChild(Node oldChild, Node newChild)
    {
        // Replace child
        if(this._stmts_ == oldChild)
        {
            setStmts((StatementList) newChild);
            return;
        }

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