content: /* This file was generated by SableCC (http://www.sablecc.org/). */
  
  package com.abstratt.mdd.frontend.textuml.grammar.node;
  
  import java.util.*;
  import com.abstratt.mdd.frontend.textuml.grammar.analysis.*;
  
  @SuppressWarnings("nls")
  public final class AStateDecl extends PStateDecl
  {
      private TModelComment _modelComment_;
      private PStateModifierList _stateModifierList_;
      private TState _state_;
      private TIdentifier _identifier_;
      private final LinkedList<PStateBehavior> _stateBehavior_ = new LinkedList<PStateBehavior>();
      private final LinkedList<PTransitionDecl> _transitionDecl_ = new LinkedList<PTransitionDecl>();
      private TEnd _end_;
      private TSemicolon _semicolon_;
  
      public AStateDecl()
      {
          // Constructor
      }
  
      public AStateDecl(
          @SuppressWarnings("hiding") TModelComment _modelComment_,
          @SuppressWarnings("hiding") PStateModifierList _stateModifierList_,
          @SuppressWarnings("hiding") TState _state_,
          @SuppressWarnings("hiding") TIdentifier _identifier_,
          @SuppressWarnings("hiding") List<PStateBehavior> _stateBehavior_,
          @SuppressWarnings("hiding") List<PTransitionDecl> _transitionDecl_,
          @SuppressWarnings("hiding") TEnd _end_,
          @SuppressWarnings("hiding") TSemicolon _semicolon_)
      {
          // Constructor
          setModelComment(_modelComment_);
  
          setStateModifierList(_stateModifierList_);
  
          setState(_state_);
  
          setIdentifier(_identifier_);
  
          setStateBehavior(_stateBehavior_);
  
          setTransitionDecl(_transitionDecl_);
  
          setEnd(_end_);
  
          setSemicolon(_semicolon_);
  
      }
  
      @Override
      public Object clone()
      {
          return new AStateDecl(
              cloneNode(this._modelComment_),
              cloneNode(this._stateModifierList_),
              cloneNode(this._state_),
              cloneNode(this._identifier_),
              cloneList(this._stateBehavior_),
              cloneList(this._transitionDecl_),
              cloneNode(this._end_),
              cloneNode(this._semicolon_));
      }
  
      public void apply(Switch sw)
      {
          ((Analysis) sw).caseAStateDecl(this);
      }
  
      public TModelComment getModelComment()
      {
          return this._modelComment_;
      }
  
      public void setModelComment(TModelComment node)
      {
          if(this._modelComment_ != null)
          {
              this._modelComment_.parent(null);
          }
  
          if(node != null)
          {
              if(node.parent() != null)
              {
                  node.parent().removeChild(node);
              }
  
              node.parent(this);
          }
  
          this._modelComment_ = node;
      }
  
      public PStateModifierList getStateModifierList()
      {
          return this._stateModifierList_;
      }
  
      public void setStateModifierList(PStateModifierList node)
      {
          if(this._stateModifierList_ != null)
          {
              this._stateModifierList_.parent(null);
          }
  
          if(node != null)
          {
              if(node.parent() != null)
              {
                  node.parent().removeChild(node);
              }
  
              node.parent(this);
          }
  
          this._stateModifierList_ = node;
      }
  
      public TState getState()
      {
          return this._state_;
      }
  
      public void setState(TState node)
      {
          if(this._state_ != null)
          {
              this._state_.parent(null);
          }
  
          if(node != null)
          {
              if(node.parent() != null)
              {
                  node.parent().removeChild(node);
              }
  
              node.parent(this);
          }
  
          this._state_ = node;
      }
  
      public TIdentifier getIdentifier()
      {
          return this._identifier_;
      }
  
      public void setIdentifier(TIdentifier node)
      {
          if(this._identifier_ != null)
          {
              this._identifier_.parent(null);
          }
  
          if(node != null)
          {
              if(node.parent() != null)
              {
                  node.parent().removeChild(node);
              }
  
              node.parent(this);
          }
  
          this._identifier_ = node;
      }
  
      public LinkedList<PStateBehavior> getStateBehavior()
      {
          return this._stateBehavior_;
      }
  
      public void setStateBehavior(List<PStateBehavior> list)
      {
          this._stateBehavior_.clear();
          this._stateBehavior_.addAll(list);
          for(PStateBehavior e : list)
          {
              if(e.parent() != null)
              {
                  e.parent().removeChild(e);
              }
  
              e.parent(this);
          }
      }
  
      public LinkedList<PTransitionDecl> getTransitionDecl()
      {
          return this._transitionDecl_;
      }
  
      public void setTransitionDecl(List<PTransitionDecl> list)
      {
          this._transitionDecl_.clear();
          this._transitionDecl_.addAll(list);
          for(PTransitionDecl e : list)
          {
              if(e.parent() != null)
              {
                  e.parent().removeChild(e);
              }
  
              e.parent(this);
          }
      }
  
      public TEnd getEnd()
      {
          return this._end_;
      }
  
      public void setEnd(TEnd node)
      {
          if(this._end_ != null)
          {
              this._end_.parent(null);
          }
  
          if(node != null)
          {
              if(node.parent() != null)
              {
                  node.parent().removeChild(node);
              }
  
              node.parent(this);
          }
  
          this._end_ = node;
      }
  
      public TSemicolon getSemicolon()
      {
          return this._semicolon_;
      }
  
      public void setSemicolon(TSemicolon node)
      {
          if(this._semicolon_ != null)
          {
              this._semicolon_.parent(null);
          }
  
          if(node != null)
          {
              if(node.parent() != null)
              {
                  node.parent().removeChild(node);
              }
  
              node.parent(this);
          }
  
          this._semicolon_ = node;
      }
  
      @Override
      public String toString()
      {
          return ""
              + toString(this._modelComment_)
              + toString(this._stateModifierList_)
              + toString(this._state_)
              + toString(this._identifier_)
              + toString(this._stateBehavior_)
              + toString(this._transitionDecl_)
              + toString(this._end_)
              + toString(this._semicolon_);
      }
  
      @Override
      void removeChild(@SuppressWarnings("unused") Node child)
      {
          // Remove child
          if(this._modelComment_ == child)
          {
              this._modelComment_ = null;
              return;
          }
  
          if(this._stateModifierList_ == child)
          {
              this._stateModifierList_ = null;
              return;
          }
  
          if(this._state_ == child)
          {
              this._state_ = null;
              return;
          }
  
          if(this._identifier_ == child)
          {
              this._identifier_ = null;
              return;
          }
  
          if(this._stateBehavior_.remove(child))
          {
              return;
          }
  
          if(this._transitionDecl_.remove(child))
          {
              return;
          }
  
          if(this._end_ == child)
          {
              this._end_ = null;
              return;
          }
  
          if(this._semicolon_ == child)
          {
              this._semicolon_ = null;
              return;
          }
  
          throw new RuntimeException("Not a child.");
      }
  
      @Override
      void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
      {
          // Replace child
          if(this._modelComment_ == oldChild)
          {
              setModelComment((TModelComment) newChild);
              return;
          }
  
          if(this._stateModifierList_ == oldChild)
          {
              setStateModifierList((PStateModifierList) newChild);
              return;
          }
  
          if(this._state_ == oldChild)
          {
              setState((TState) newChild);
              return;
          }
  
          if(this._identifier_ == oldChild)
          {
              setIdentifier((TIdentifier) newChild);
              return;
          }
  
          for(ListIterator<PStateBehavior> i = this._stateBehavior_.listIterator(); i.hasNext();)
          {
              if(i.next() == oldChild)
              {
                  if(newChild != null)
                  {
                      i.set((PStateBehavior) newChild);
                      newChild.parent(this);
                      oldChild.parent(null);
                      return;
                  }
  
                  i.remove();
                  oldChild.parent(null);
                  return;
              }
          }
  
          for(ListIterator<PTransitionDecl> i = this._transitionDecl_.listIterator(); i.hasNext();)
          {
              if(i.next() == oldChild)
              {
                  if(newChild != null)
                  {
                      i.set((PTransitionDecl) newChild);
                      newChild.parent(this);
                      oldChild.parent(null);
                      return;
                  }
  
                  i.remove();
                  oldChild.parent(null);
                  return;
              }
          }
  
          if(this._end_ == oldChild)
          {
              setEnd((TEnd) newChild);
              return;
          }
  
          if(this._semicolon_ == oldChild)
          {
              setSemicolon((TSemicolon) newChild);
              return;
          }
  
          throw new RuntimeException("Not a child.");
      }
  }
  