/* 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 AElem extends PElem
{
  private TId _elemName_;
  private PSpecifier _specifier_;
  private TId _id_;
  private PUnOp _unOp_;

  public AElem()
  {}

  public AElem(
    TId _elemName_,
    PSpecifier _specifier_,
    TId _id_,
    PUnOp _unOp_)
  {
    setElemName(_elemName_);

    setSpecifier(_specifier_);

    setId(_id_);

    setUnOp(_unOp_);

  }
  public Object clone()
  {
    return new AElem(
             (TId) cloneNode(_elemName_),
             (PSpecifier) cloneNode(_specifier_),
             (TId) cloneNode(_id_),
             (PUnOp) cloneNode(_unOp_));
  }

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

  public TId getElemName()
  {
    return _elemName_;
  }

  public void setElemName(TId node)
  {
    if(_elemName_ != null)
    {
      _elemName_.parent(null);
    }

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

      node.parent(this);
    }

    _elemName_ = node;
  }

  public PSpecifier getSpecifier()
  {
    return _specifier_;
  }

  public void setSpecifier(PSpecifier node)
  {
    if(_specifier_ != null)
    {
      _specifier_.parent(null);
    }

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

      node.parent(this);
    }

    _specifier_ = 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 PUnOp getUnOp()
  {
    return _unOp_;
  }

  public void setUnOp(PUnOp node)
  {
    if(_unOp_ != null)
    {
      _unOp_.parent(null);
    }

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

      node.parent(this);
    }

    _unOp_ = node;
  }

  public String toString()
  {
    return ""
           + toString(_elemName_)
           + toString(_specifier_)
           + toString(_id_)
           + toString(_unOp_);
  }

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

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

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

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

  }

  void replaceChild(Node oldChild, Node newChild)
  {
    if(_elemName_ == oldChild)
    {
      setElemName((TId) newChild);
      return;
    }

    if(_specifier_ == oldChild)
    {
      setSpecifier((PSpecifier) newChild);
      return;
    }

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

    if(_unOp_ == oldChild)
    {
      setUnOp((PUnOp) newChild);
      return;
    }

  }
}
