package com.alibaba.druid.sql.ast;

import com.alibaba.druid.sql.visitor.SQLASTVisitor;

public class SQLPartitionByRange extends SQLPartitionBy {
   protected SQLExpr interval;

   public SQLExpr getInterval() {
      return this.interval;
   }

   public void setInterval(SQLExpr interval) {
      if (interval != null) {
         interval.setParent(this);
      }

      this.interval = interval;
   }

   protected void accept0(SQLASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.columns);
         this.acceptChild(visitor, this.interval);
         this.acceptChild(visitor, this.storeIn);
         this.acceptChild(visitor, this.partitions);
         this.acceptChild(visitor, this.subPartitionBy);
      }

      visitor.endVisit(this);
   }

   public SQLPartitionByRange clone() {
      SQLPartitionByRange x = new SQLPartitionByRange();
      this.cloneTo(x);
      if (this.interval != null) {
         x.setInterval(this.interval.clone());
      }

      for(SQLExpr column : this.columns) {
         SQLExpr c2 = column.clone();
         c2.setParent(x);
         x.columns.add(c2);
      }

      return x;
   }

   public void cloneTo(SQLPartitionByRange x) {
      super.cloneTo(x);
   }
}
