package com.chenyang.druid.sql.ast;

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

public final class SQLKeep extends SQLObjectImpl {
   protected DenseRank denseRank;
   protected SQLOrderBy orderBy;

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

      visitor.endVisit(this);
   }

   public DenseRank getDenseRank() {
      return this.denseRank;
   }

   public void setDenseRank(DenseRank denseRank) {
      this.denseRank = denseRank;
   }

   public SQLOrderBy getOrderBy() {
      return this.orderBy;
   }

   public void setOrderBy(SQLOrderBy orderBy) {
      if (orderBy != null) {
         orderBy.setParent(this);
      }

      this.orderBy = orderBy;
   }

   public SQLKeep clone() {
      SQLKeep x = new SQLKeep();
      x.denseRank = this.denseRank;
      if (this.orderBy != null) {
         x.setOrderBy(this.orderBy.clone());
      }

      return x;
   }

   public static enum DenseRank {
      FIRST,
      LAST;
   }
}
