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 AOperationDecl extends POperationDecl
  {
      private POperationHeader _operationHeader_;
      private final LinkedList<POperationConstraint> _operationConstraint_ = new LinkedList<POperationConstraint>();
      private TSemicolon _semicolon_;
      private POptionalBehavioralFeatureBody _optionalBehavioralFeatureBody_;
  
      public AOperationDecl()
      {
          // Constructor
      }
  
      public AOperationDecl(
          @SuppressWarnings("hiding") POperationHeader _operationHeader_,
          @SuppressWarnings("hiding") List<POperationConstraint> _operationConstraint_,
          @SuppressWarnings("hiding") TSemicolon _semicolon_,
          @SuppressWarnings("hiding") POptionalBehavioralFeatureBody _optionalBehavioralFeatureBody_)
      {
          // Constructor
          setOperationHeader(_operationHeader_);
  
          setOperationConstraint(_operationConstraint_);
  
          setSemicolon(_semicolon_);
  
          setOptionalBehavioralFeatureBody(_optionalBehavioralFeatureBody_);
  
      }
  
      @Override
      public Object clone()
      {
          return new AOperationDecl(
              cloneNode(this._operationHeader_),
              cloneList(this._operationConstraint_),
              cloneNode(this._semicolon_),
              cloneNode(this._optionalBehavioralFeatureBody_));
      }
  
      public void apply(Switch sw)
      {
          ((Analysis) sw).caseAOperationDecl(this);
      }
  
      public POperationHeader getOperationHeader()
      {
          return this._operationHeader_;
      }
  
      public void setOperationHeader(POperationHeader node)
      {
          if(this._operationHeader_ != null)
          {
              this._operationHeader_.parent(null);
          }
  
          if(node != null)
          {
              if(node.parent() != null)
              {
                  node.parent().removeChild(node);
              }
  
              node.parent(this);
          }
  
          this._operationHeader_ = node;
      }
  
      public LinkedList<POperationConstraint> getOperationConstraint()
      {
          return this._operationConstraint_;
      }
  
      public void setOperationConstraint(List<POperationConstraint> list)
      {
          this._operationConstraint_.clear();
          this._operationConstraint_.addAll(list);
          for(POperationConstraint 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;
      }
  
      public POptionalBehavioralFeatureBody getOptionalBehavioralFeatureBody()
      {
          return this._optionalBehavioralFeatureBody_;
      }
  
      public void setOptionalBehavioralFeatureBody(POptionalBehavioralFeatureBody node)
      {
          if(this._optionalBehavioralFeatureBody_ != null)
          {
              this._optionalBehavioralFeatureBody_.parent(null);
          }
  
          if(node != null)
          {
              if(node.parent() != null)
              {
                  node.parent().removeChild(node);
              }
  
              node.parent(this);
          }
  
          this._optionalBehavioralFeatureBody_ = node;
      }
  
      @Override
      public String toString()
      {
          return ""
              + toString(this._operationHeader_)
              + toString(this._operationConstraint_)
              + toString(this._semicolon_)
              + toString(this._optionalBehavioralFeatureBody_);
      }
  
      @Override
      void removeChild(@SuppressWarnings("unused") Node child)
      {
          // Remove child
          if(this._operationHeader_ == child)
          {
              this._operationHeader_ = null;
              return;
          }
  
          if(this._operationConstraint_.remove(child))
          {
              return;
          }
  
          if(this._semicolon_ == child)
          {
              this._semicolon_ = null;
              return;
          }
  
          if(this._optionalBehavioralFeatureBody_ == child)
          {
              this._optionalBehavioralFeatureBody_ = null;
              return;
          }
  
          throw new RuntimeException("Not a child.");
      }
  
      @Override
      void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
      {
          // Replace child
          if(this._operationHeader_ == oldChild)
          {
              setOperationHeader((POperationHeader) newChild);
              return;
          }
  
          for(ListIterator<POperationConstraint> i = this._operationConstraint_.listIterator(); i.hasNext();)
          {
              if(i.next() == oldChild)
              {
                  if(newChild != null)
                  {
                      i.set((POperationConstraint) newChild);
                      newChild.parent(this);
                      oldChild.parent(null);
                      return;
                  }
  
                  i.remove();
                  oldChild.parent(null);
                  return;
              }
          }
  
          if(this._semicolon_ == oldChild)
          {
              setSemicolon((TSemicolon) newChild);
              return;
          }
  
          if(this._optionalBehavioralFeatureBody_ == oldChild)
          {
              setOptionalBehavioralFeatureBody((POptionalBehavioralFeatureBody) newChild);
              return;
          }
  
          throw new RuntimeException("Not a child.");
      }
  }
  