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

package org.sablecc.sablecc.node;

import java.util.*;
import org.sablecc.sablecc.analysis.*;

public final class ATokenDef extends PTokenDef
{
  private PStateList _stateList_;
  private TId _id_;
  private PRegExp _regExp_;
  private TSlash _slash_;
  private PRegExp _lookAhead_;

  public ATokenDef()
  {}

  public ATokenDef(
    PStateList _stateList_,
    TId _id_,
    PRegExp _regExp_,
    TSlash _slash_,
    PRegExp _lookAhead_)
  {
    setStateList(_stateList_);

    setId(_id_);

    setRegExp(_regExp_);

    setSlash(_slash_);

    setLookAhead(_lookAhead_);

  }
  public Object clone()
  {
    return new ATokenDef(
             (PStateList) cloneNode(_stateList_),
             (TId) cloneNode(_id_),
             (PRegExp) cloneNode(_regExp_),
             (TSlash) cloneNode(_slash_),
             (PRegExp) cloneNode(_lookAhead_));
  }

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

  public PStateList getStateList()
  {
    return _stateList_;
  }

  public void setStateList(PStateList node)
  {
    if(_stateList_ != null)
    {
      _stateList_.parent(null);
    }

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

      node.parent(this);
    }

    _stateList_ = node;
  }

  public TId getId()
  {
    return _id_;
  }

  public void setId(TId node)
  {
    if(_id_ != null)
    {
      _id_.parent(null);
    }

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

      node.parent(this);
    }

    _id_ = node;
  }

  public PRegExp getRegExp()
  {
    return _regExp_;
  }

  public void setRegExp(PRegExp node)
  {
    if(_regExp_ != null)
    {
      _regExp_.parent(null);
    }

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

      node.parent(this);
    }

    _regExp_ = node;
  }

  public TSlash getSlash()
  {
    return _slash_;
  }

  public void setSlash(TSlash node)
  {
    if(_slash_ != null)
    {
      _slash_.parent(null);
    }

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

      node.parent(this);
    }

    _slash_ = node;
  }

  public PRegExp getLookAhead()
  {
    return _lookAhead_;
  }

  public void setLookAhead(PRegExp node)
  {
    if(_lookAhead_ != null)
    {
      _lookAhead_.parent(null);
    }

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

      node.parent(this);
    }

    _lookAhead_ = node;
  }

  public String toString()
  {
    return ""
           + toString(_stateList_)
           + toString(_id_)
           + toString(_regExp_)
           + toString(_slash_)
           + toString(_lookAhead_);
  }

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

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

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

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

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

  }

  void replaceChild(Node oldChild, Node newChild)
  {
    if(_stateList_ == oldChild)
    {
      setStateList((PStateList) newChild);
      return;
    }

    if(_id_ == oldChild)
    {
      setId((TId) newChild);
      return;
    }

    if(_regExp_ == oldChild)
    {
      setRegExp((PRegExp) newChild);
      return;
    }

    if(_slash_ == oldChild)
    {
      setSlash((TSlash) newChild);
      return;
    }

    if(_lookAhead_ == oldChild)
    {
      setLookAhead((PRegExp) newChild);
      return;
    }

  }
}
