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

package org.sablecc.sablecc.node;

import org.sablecc.sablecc.analysis.*;

public final class Start extends Node
{
  private PGrammar _pGrammar_;
  private EOF _eof_;

  public Start()
  {}

  public Start(
    PGrammar _pGrammar_,
    EOF _eof_)
  {
    setPGrammar(_pGrammar_);
    setEOF(_eof_);
  }

  public Object clone()
  {
    return new Start(
             (PGrammar) cloneNode(_pGrammar_),
             (EOF) cloneNode(_eof_));
  }

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

  public PGrammar getPGrammar()
  {
    return _pGrammar_;
  }

  public void setPGrammar(PGrammar node)
  {
    if(_pGrammar_ != null)
    {
      _pGrammar_.parent(null);
    }

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

      node.parent(this);
    }

    _pGrammar_ = 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(_pGrammar_ == child)
    {
      _pGrammar_ = null;
      return;
    }

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

  void replaceChild(Node oldChild, Node newChild)
  {
    if(_pGrammar_ == oldChild)
    {
      setPGrammar((PGrammar) newChild);
      return;
    }

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

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