package com.alibaba.druid.sql.dialect.gauss.ast.stmt.alterTable;

import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.statement.SQLAlterTableItem;
import com.alibaba.druid.sql.dialect.gauss.ast.GaussSQLObjectImpl;
import com.alibaba.druid.sql.dialect.gauss.visitor.GaussASTVisitor;
import java.util.ArrayList;
import java.util.List;

public class GaussAlterTableSetNewTableSpace extends GaussSQLObjectImpl implements SQLAlterTableItem {
   private SQLExpr name;
   private List<SQLExpr> owners = new ArrayList();
   private SQLExpr newTablespace = null;
   private boolean nowait = false;

   public void accept0(GaussASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.name);
         this.acceptChild(visitor, this.owners);
         this.acceptChild(visitor, this.newTablespace);
      }

      visitor.endVisit(this);
   }

   public void addOwner(SQLExpr owner) {
      owner.setParent(this);
      this.owners.add(owner);
   }

   public SQLExpr getNewTablespace() {
      return this.newTablespace;
   }

   public void setNewTablespace(SQLExpr newTablespace) {
      this.newTablespace = newTablespace;
      newTablespace.setParent(this);
   }

   public List<SQLExpr> getOwners() {
      return this.owners;
   }

   public void setOwners(List<SQLExpr> owners) {
      this.owners = owners;
   }

   public boolean isNowait() {
      return this.nowait;
   }

   public void setNowait(boolean nowait) {
      this.nowait = nowait;
   }

   public SQLExpr getName() {
      return this.name;
   }

   public void setName(SQLExpr name) {
      this.name = name;
      name.setParent(this);
   }

   public GaussAlterTableSetNewTableSpace clone() {
      GaussAlterTableSetNewTableSpace c = new GaussAlterTableSetNewTableSpace();
      c.setName(this.name.clone());

      for(SQLExpr owner : this.owners) {
         c.addOwner(owner.clone());
      }

      c.setNewTablespace(this.newTablespace.clone());
      c.nowait = this.nowait;
      return c;
   }
}
