package com.chenyang.druid.sql.dialect.hive.ast.stmt;

import com.chenyang.druid.DbType;
import com.chenyang.druid.sql.ast.statement.SQLDeleteStatement;
import com.chenyang.druid.sql.ast.statement.SQLTableSource;
import com.chenyang.druid.sql.dialect.gauss.ast.stmt.GaussSQLStatement;
import com.chenyang.druid.sql.dialect.gauss.visitor.GaussASTVisitor;
import com.chenyang.druid.sql.visitor.SQLASTVisitor;
import java.util.List;

public class HiveDeleteStatement extends SQLDeleteStatement implements GaussSQLStatement {
   private boolean returning;
   protected List<SQLTableSource> usingList;

   public HiveDeleteStatement() {
      super(DbType.gauss);
   }

   public boolean isReturning() {
      return this.returning;
   }

   public void setReturning(boolean returning) {
      this.returning = returning;
   }

   public List<SQLTableSource> getUsingList() {
      return this.usingList;
   }

   public void setUsingList(List<SQLTableSource> usingList) {
      this.usingList = usingList;
   }

   public String getAlias() {
      return this.tableSource == null ? null : this.tableSource.getAlias();
   }

   public void setAlias(String alias) {
      this.tableSource.setAlias(alias);
   }

   protected void accept0(SQLASTVisitor visitor) {
      if (visitor instanceof GaussASTVisitor) {
         this.accept0((GaussASTVisitor)visitor);
      } else {
         super.accept0(visitor);
      }

   }

   public void accept0(GaussASTVisitor visitor) {
      if (visitor.visit((SQLDeleteStatement)this)) {
         this.acceptChild(visitor, this.with);
         this.acceptChild(visitor, this.tableSource);
         this.acceptChild(visitor, this.using);
         this.acceptChild(visitor, this.where);
      }

      visitor.endVisit((SQLDeleteStatement)this);
   }

   public HiveDeleteStatement clone() {
      HiveDeleteStatement x = new HiveDeleteStatement();
      this.cloneTo(x);
      x.returning = this.returning;
      return x;
   }
}
