package com.alibaba.druid.sql.ast.statement;

import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.SQLName;
import com.alibaba.druid.sql.ast.SQLObjectImpl;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
import java.util.ArrayList;
import java.util.List;

public class SQLAlterTableExchangePartition extends SQLObjectImpl implements SQLAlterTableItem {
   private List<SQLExpr> partitions = new ArrayList();
   private SQLExprTableSource table;
   private Boolean validation;

   protected void accept0(SQLASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.partitions);
         this.acceptChild(visitor, this.table);
      }

      visitor.endVisit(this);
   }

   public List<SQLExpr> getPartitions() {
      return this.partitions;
   }

   public void addPartition(SQLExpr x) {
      if (x != null) {
         x.setParent(this);
      }

      this.partitions.add(x);
   }

   public SQLExprTableSource getTable() {
      return this.table;
   }

   public void setTable(SQLName x) {
      this.setTable(new SQLExprTableSource(x));
   }

   public void setTable(SQLExprTableSource x) {
      if (x != null) {
         x.setParent(this);
      }

      this.table = x;
   }

   public void setValidation(boolean validation) {
      this.validation = validation;
   }

   public Boolean getValidation() {
      return this.validation;
   }
}
