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 AAttributeDecl extends PAttributeDecl
  {
      private TAttribute _attribute_;
      private TIdentifier _identifier_;
      private TColon _colon_;
      private PTypeIdentifier _typeIdentifier_;
      private POptionalSubsetting _optionalSubsetting_;
      private PInitializationExpression _initializationExpression_;
      private final LinkedList<PAttributeInvariant> _attributeInvariant_ = new LinkedList<PAttributeInvariant>();
      private TSemicolon _semicolon_;
  
      public AAttributeDecl()
      {
          // Constructor
      }
  
      public AAttributeDecl(
          @SuppressWarnings("hiding") TAttribute _attribute_,
          @SuppressWarnings("hiding") TIdentifier _identifier_,
          @SuppressWarnings("hiding") TColon _colon_,
          @SuppressWarnings("hiding") PTypeIdentifier _typeIdentifier_,
          @SuppressWarnings("hiding") POptionalSubsetting _optionalSubsetting_,
          @SuppressWarnings("hiding") PInitializationExpression _initializationExpression_,
          @SuppressWarnings("hiding") List<PAttributeInvariant> _attributeInvariant_,
          @SuppressWarnings("hiding") TSemicolon _semicolon_)
      {
          // Constructor
          setAttribute(_attribute_);
  
          setIdentifier(_identifier_);
  
          setColon(_colon_);
  
          setTypeIdentifier(_typeIdentifier_);
  
          setOptionalSubsetting(_optionalSubsetting_);
  
          setInitializationExpression(_initializationExpression_);
  
          setAttributeInvariant(_attributeInvariant_);
  
          setSemicolon(_semicolon_);
  
      }
  
      @Override
      public Object clone()
      {
          return new AAttributeDecl(
              cloneNode(this._attribute_),
              cloneNode(this._identifier_),
              cloneNode(this._colon_),
              cloneNode(this._typeIdentifier_),
              cloneNode(this._optionalSubsetting_),
              cloneNode(this._initializationExpression_),
              cloneList(this._attributeInvariant_),
              cloneNode(this._semicolon_));
      }
  
      public void apply(Switch sw)
      {
          ((Analysis) sw).caseAAttributeDecl(this);
      }
  
      public TAttribute getAttribute()
      {
          return this._attribute_;
      }
  
      public void setAttribute(TAttribute node)
      {
          if(this._attribute_ != null)
          {
              this._attribute_.parent(null);
          }
  
          if(node != null)
          {
              if(node.parent() != null)
              {
                  node.parent().removeChild(node);
              }
  
              node.parent(this);
          }
  
          this._attribute_ = 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 TColon getColon()
      {
          return this._colon_;
      }
  
      public void setColon(TColon node)
      {
          if(this._colon_ != null)
          {
              this._colon_.parent(null);
          }
  
          if(node != null)
          {
              if(node.parent() != null)
              {
                  node.parent().removeChild(node);
              }
  
              node.parent(this);
          }
  
          this._colon_ = node;
      }
  
      public PTypeIdentifier getTypeIdentifier()
      {
          return this._typeIdentifier_;
      }
  
      public void setTypeIdentifier(PTypeIdentifier node)
      {
          if(this._typeIdentifier_ != null)
          {
              this._typeIdentifier_.parent(null);
          }
  
          if(node != null)
          {
              if(node.parent() != null)
              {
                  node.parent().removeChild(node);
              }
  
              node.parent(this);
          }
  
          this._typeIdentifier_ = node;
      }
  
      public POptionalSubsetting getOptionalSubsetting()
      {
          return this._optionalSubsetting_;
      }
  
      public void setOptionalSubsetting(POptionalSubsetting node)
      {
          if(this._optionalSubsetting_ != null)
          {
              this._optionalSubsetting_.parent(null);
          }
  
          if(node != null)
          {
              if(node.parent() != null)
              {
                  node.parent().removeChild(node);
              }
  
              node.parent(this);
          }
  
          this._optionalSubsetting_ = node;
      }
  
      public PInitializationExpression getInitializationExpression()
      {
          return this._initializationExpression_;
      }
  
      public void setInitializationExpression(PInitializationExpression node)
      {
          if(this._initializationExpression_ != null)
          {
              this._initializationExpression_.parent(null);
          }
  
          if(node != null)
          {
              if(node.parent() != null)
              {
                  node.parent().removeChild(node);
              }
  
              node.parent(this);
          }
  
          this._initializationExpression_ = node;
      }
  
      public LinkedList<PAttributeInvariant> getAttributeInvariant()
      {
          return this._attributeInvariant_;
      }
  
      public void setAttributeInvariant(List<PAttributeInvariant> list)
      {
          this._attributeInvariant_.clear();
          this._attributeInvariant_.addAll(list);
          for(PAttributeInvariant e : list)
          {
              if(e.parent() != null)
              {
                  e.parent().removeChild(e);
              }
  
              e.parent(this);
          }
      }
  
      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._attribute_)
              + toString(this._identifier_)
              + toString(this._colon_)
              + toString(this._typeIdentifier_)
              + toString(this._optionalSubsetting_)
              + toString(this._initializationExpression_)
              + toString(this._attributeInvariant_)
              + toString(this._semicolon_);
      }
  
      @Override
      void removeChild(@SuppressWarnings("unused") Node child)
      {
          // Remove child
          if(this._attribute_ == child)
          {
              this._attribute_ = null;
              return;
          }
  
          if(this._identifier_ == child)
          {
              this._identifier_ = null;
              return;
          }
  
          if(this._colon_ == child)
          {
              this._colon_ = null;
              return;
          }
  
          if(this._typeIdentifier_ == child)
          {
              this._typeIdentifier_ = null;
              return;
          }
  
          if(this._optionalSubsetting_ == child)
          {
              this._optionalSubsetting_ = null;
              return;
          }
  
          if(this._initializationExpression_ == child)
          {
              this._initializationExpression_ = null;
              return;
          }
  
          if(this._attributeInvariant_.remove(child))
          {
              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._attribute_ == oldChild)
          {
              setAttribute((TAttribute) newChild);
              return;
          }
  
          if(this._identifier_ == oldChild)
          {
              setIdentifier((TIdentifier) newChild);
              return;
          }
  
          if(this._colon_ == oldChild)
          {
              setColon((TColon) newChild);
              return;
          }
  
          if(this._typeIdentifier_ == oldChild)
          {
              setTypeIdentifier((PTypeIdentifier) newChild);
              return;
          }
  
          if(this._optionalSubsetting_ == oldChild)
          {
              setOptionalSubsetting((POptionalSubsetting) newChild);
              return;
          }
  
          if(this._initializationExpression_ == oldChild)
          {
              setInitializationExpression((PInitializationExpression) newChild);
              return;
          }
  
          for(ListIterator<PAttributeInvariant> i = this._attributeInvariant_.listIterator(); i.hasNext();)
          {
              if(i.next() == oldChild)
              {
                  if(newChild != null)
                  {
                      i.set((PAttributeInvariant) newChild);
                      newChild.parent(this);
                      oldChild.parent(null);
                      return;
                  }
  
                  i.remove();
                  oldChild.parent(null);
                  return;
              }
          }
  
          if(this._semicolon_ == oldChild)
          {
              setSemicolon((TSemicolon) newChild);
              return;
          }
  
          throw new RuntimeException("Not a child.");
      }
  }
  