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

import com.chenyang.druid.sql.ast.SQLExpr;
import com.chenyang.druid.sql.ast.SQLName;
import com.chenyang.druid.sql.ast.SQLObject;
import com.chenyang.druid.sql.ast.SQLStatementImpl;
import com.chenyang.druid.sql.ast.expr.SQLPropertyExpr;
import com.chenyang.druid.sql.visitor.SQLASTVisitor;
import java.util.ArrayList;
import java.util.List;

public class SQLCreateSequenceStatement extends SQLStatementImpl implements SQLCreateStatement {
   private SQLName name;
   private SQLExpr startWith;
   private SQLExpr incrementBy;
   private SQLExpr minValue;
   private SQLExpr maxValue;
   private boolean noMaxValue;
   private boolean noMinValue;
   private Boolean withCache;
   private Boolean cycle;
   private Boolean cache;
   private SQLExpr cacheValue;
   private Boolean order;
   private Boolean global;
   private Boolean local;
   private boolean simple;
   private boolean group;
   private boolean time;
   private SQLExpr unitCount;
   private SQLExpr unitIndex;
   private SQLExpr step;

   public void accept0(SQLASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.name);
         this.acceptChild(visitor, this.startWith);
         this.acceptChild(visitor, this.incrementBy);
         this.acceptChild(visitor, this.minValue);
         this.acceptChild(visitor, this.maxValue);
      }

      visitor.endVisit(this);
   }

   public List<SQLObject> getChildren() {
      List<SQLObject> children = new ArrayList();
      if (this.name != null) {
         children.add(this.name);
      }

      if (this.startWith != null) {
         children.add(this.startWith);
      }

      if (this.incrementBy != null) {
         children.add(this.incrementBy);
      }

      if (this.minValue != null) {
         children.add(this.minValue);
      }

      if (this.maxValue != null) {
         children.add(this.maxValue);
      }

      return children;
   }

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

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

   public SQLExpr getStartWith() {
      return this.startWith;
   }

   public void setStartWith(SQLExpr startWith) {
      this.startWith = startWith;
   }

   public SQLExpr getIncrementBy() {
      return this.incrementBy;
   }

   public void setIncrementBy(SQLExpr incrementBy) {
      this.incrementBy = incrementBy;
   }

   public SQLExpr getMaxValue() {
      return this.maxValue;
   }

   public void setMaxValue(SQLExpr maxValue) {
      this.maxValue = maxValue;
   }

   public Boolean getCycle() {
      return this.cycle;
   }

   public void setCycle(Boolean cycle) {
      this.cycle = cycle;
   }

   public Boolean getCache() {
      return this.cache;
   }

   public void setCache(Boolean cache) {
      this.cache = cache;
   }

   public Boolean getOrder() {
      return this.order;
   }

   public void setOrder(Boolean order) {
      this.order = order;
   }

   public SQLExpr getMinValue() {
      return this.minValue;
   }

   public void setMinValue(SQLExpr minValue) {
      this.minValue = minValue;
   }

   public boolean isNoMaxValue() {
      return this.noMaxValue;
   }

   public void setNoMaxValue(boolean noMaxValue) {
      this.noMaxValue = noMaxValue;
   }

   public boolean isNoMinValue() {
      return this.noMinValue;
   }

   public void setNoMinValue(boolean noMinValue) {
      this.noMinValue = noMinValue;
   }

   public String getSchema() {
      SQLName name = this.getName();
      if (name == null) {
         return null;
      } else {
         return name instanceof SQLPropertyExpr ? ((SQLPropertyExpr)name).getOwnernName() : null;
      }
   }

   public SQLExpr getCacheValue() {
      return this.cacheValue;
   }

   public void setCacheValue(SQLExpr cacheValue) {
      if (cacheValue != null) {
         cacheValue.setParent(this);
      }

      this.cacheValue = cacheValue;
   }

   public boolean isSimple() {
      return this.simple;
   }

   public void setSimple(boolean simple) {
      this.simple = simple;
   }

   public boolean isGroup() {
      return this.group;
   }

   public void setGroup(boolean group) {
      this.group = group;
   }

   public SQLExpr getUnitCount() {
      return this.unitCount;
   }

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

      this.unitCount = x;
   }

   public SQLExpr getUnitIndex() {
      return this.unitIndex;
   }

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

      this.unitIndex = x;
   }

   public boolean isTime() {
      return this.time;
   }

   public void setTime(boolean time) {
      this.time = time;
   }

   public Boolean getWithCache() {
      return this.withCache;
   }

   public void setWithCache(Boolean withCache) {
      this.withCache = withCache;
   }

   public SQLExpr getStep() {
      return this.step;
   }

   public void setStep(SQLExpr step) {
      if (step != null) {
         step.setParent(this);
      }

      this.step = step;
   }

   public Boolean getGlobal() {
      return this.global;
   }

   public void setGlobal(Boolean global) {
      this.global = global;
   }

   public Boolean getLocal() {
      return this.local;
   }

   public void setLocal(Boolean local) {
      this.local = local;
   }
}
