/* 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 AOperationSet extends PSet
{
  private PBasic _left_;
  private PBinOp _binOp_;
  private PBasic _right_;

  public AOperationSet()
  {}

  public AOperationSet(
    PBasic _left_,
    PBinOp _binOp_,
    PBasic _right_)
  {
    setLeft(_left_);

    setBinOp(_binOp_);

    setRight(_right_);

  }
  public Object clone()
  {
    return new AOperationSet(
             (PBasic) cloneNode(_left_),
             (PBinOp) cloneNode(_binOp_),
             (PBasic) cloneNode(_right_));
  }

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

  public PBasic getLeft()
  {
    return _left_;
  }

  public void setLeft(PBasic node)
  {
    if(_left_ != null)
    {
      _left_.parent(null);
    }

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

      node.parent(this);
    }

    _left_ = node;
  }

  public PBinOp getBinOp()
  {
    return _binOp_;
  }

  public void setBinOp(PBinOp node)
  {
    if(_binOp_ != null)
    {
      _binOp_.parent(null);
    }

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

      node.parent(this);
    }

    _binOp_ = node;
  }

  public PBasic getRight()
  {
    return _right_;
  }

  public void setRight(PBasic node)
  {
    if(_right_ != null)
    {
      _right_.parent(null);
    }

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

      node.parent(this);
    }

    _right_ = node;
  }

  public String toString()
  {
    return ""
           + toString(_left_)
           + toString(_binOp_)
           + toString(_right_);
  }

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

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

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

  }

  void replaceChild(Node oldChild, Node newChild)
  {
    if(_left_ == oldChild)
    {
      setLeft((PBasic) newChild);
      return;
    }

    if(_binOp_ == oldChild)
    {
      setBinOp((PBinOp) newChild);
      return;
    }

    if(_right_ == oldChild)
    {
      setRight((PBasic) newChild);
      return;
    }

  }
}
