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 AStereotypeDef extends PStereotypeDef
  {
      private PAnnotations _annotations_;
      private PStereotypeDefHeader _stereotypeDefHeader_;
      private final LinkedList<PStereotypePropertyDecl> _stereotypePropertyDecl_ = new LinkedList<PStereotypePropertyDecl>();
      private TEnd _end_;
      private TSemicolon _semicolon_;
  
      public AStereotypeDef()
      {
          // Constructor
      }
  
      public AStereotypeDef(
          @SuppressWarnings("hiding") PAnnotations _annotations_,
          @SuppressWarnings("hiding") PStereotypeDefHeader _stereotypeDefHeader_,
          @SuppressWarnings("hiding") List<PStereotypePropertyDecl> _stereotypePropertyDecl_,
          @SuppressWarnings("hiding") TEnd _end_,
          @SuppressWarnings("hiding") TSemicolon _semicolon_)
      {
          // Constructor
          setAnnotations(_annotations_);
  
          setStereotypeDefHeader(_stereotypeDefHeader_);
  
          setStereotypePropertyDecl(_stereotypePropertyDecl_);
  
          setEnd(_end_);
  
          setSemicolon(_semicolon_);
  
      }
  
      @Override
      public Object clone()
      {
          return new AStereotypeDef(
              cloneNode(this._annotations_),
              cloneNode(this._stereotypeDefHeader_),
              cloneList(this._stereotypePropertyDecl_),
              cloneNode(this._end_),
              cloneNode(this._semicolon_));
      }
  
      public void apply(Switch sw)
      {
          ((Analysis) sw).caseAStereotypeDef(this);
      }
  
      public PAnnotations getAnnotations()
      {
          return this._annotations_;
      }
  
      public void setAnnotations(PAnnotations node)
      {
          if(this._annotations_ != null)
          {
              this._annotations_.parent(null);
          }
  
          if(node != null)
          {
              if(node.parent() != null)
              {
                  node.parent().removeChild(node);
              }
  
              node.parent(this);
          }
  
          this._annotations_ = node;
      }
  
      public PStereotypeDefHeader getStereotypeDefHeader()
      {
          return this._stereotypeDefHeader_;
      }
  
      public void setStereotypeDefHeader(PStereotypeDefHeader node)
      {
          if(this._stereotypeDefHeader_ != null)
          {
              this._stereotypeDefHeader_.parent(null);
          }
  
          if(node != null)
          {
              if(node.parent() != null)
              {
                  node.parent().removeChild(node);
              }
  
              node.parent(this);
          }
  
          this._stereotypeDefHeader_ = node;
      }
  
      public LinkedList<PStereotypePropertyDecl> getStereotypePropertyDecl()
      {
          return this._stereotypePropertyDecl_;
      }
  
      public void setStereotypePropertyDecl(List<PStereotypePropertyDecl> list)
      {
          this._stereotypePropertyDecl_.clear();
          this._stereotypePropertyDecl_.addAll(list);
          for(PStereotypePropertyDecl 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._annotations_)
              + toString(this._stereotypeDefHeader_)
              + toString(this._stereotypePropertyDecl_)
              + toString(this._end_)
              + toString(this._semicolon_);
      }
  
      @Override
      void removeChild(@SuppressWarnings("unused") Node child)
      {
          // Remove child
          if(this._annotations_ == child)
          {
              this._annotations_ = null;
              return;
          }
  
          if(this._stereotypeDefHeader_ == child)
          {
              this._stereotypeDefHeader_ = null;
              return;
          }
  
          if(this._stereotypePropertyDecl_.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._annotations_ == oldChild)
          {
              setAnnotations((PAnnotations) newChild);
              return;
          }
  
          if(this._stereotypeDefHeader_ == oldChild)
          {
              setStereotypeDefHeader((PStereotypeDefHeader) newChild);
              return;
          }
  
          for(ListIterator<PStereotypePropertyDecl> i = this._stereotypePropertyDecl_.listIterator(); i.hasNext();)
          {
              if(i.next() == oldChild)
              {
                  if(newChild != null)
                  {
                      i.set((PStereotypePropertyDecl) 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.");
      }
  }
  