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

package uk.co.zonetora.fj.ast.node;

import uk.co.zonetora.fj.ast.analysis.*;

public final class Start extends Node
{
    private PProg _pProg_;
    private EOF _eof_;

    public Start()
    {
    }

    public Start(
        PProg _pProg_,
        EOF _eof_)
    {
        setPProg(_pProg_);
        setEOF(_eof_);
    }

    public Object clone()
    {
        return new Start(
            (PProg) cloneNode(_pProg_),
            (EOF) cloneNode(_eof_));
    }

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

    public PProg getPProg()
    {
        return _pProg_;
    }

    public void setPProg(PProg node)
    {
        if(_pProg_ != null)
        {
            _pProg_.parent(null);
        }

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

            node.parent(this);
        }

        _pProg_ = node;
    }

    public EOF getEOF()
    {
        return _eof_;
    }

    public void setEOF(EOF node)
    {
        if(_eof_ != null)
        {
            _eof_.parent(null);
        }

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

            node.parent(this);
        }

        _eof_ = node;
    }

    void removeChild(Node child)
    {
        if(_pProg_ == child)
        {
            _pProg_ = null;
            return;
        }

        if(_eof_ == child)
        {
            _eof_ = null;
            return;
        }
    }

    void replaceChild(Node oldChild, Node newChild)
    {
        if(_pProg_ == oldChild)
        {
            setPProg((PProg) newChild);
            return;
        }

        if(_eof_ == oldChild)
        {
            setEOF((EOF) newChild);
            return;
        }
    }

    public String toString()
    {
        return "" +
            toString(_pProg_) +
            toString(_eof_);
    }
}
