package com.chenyang.druid.sql.dialect.sqlserver.ast;

import com.chenyang.druid.sql.ast.SQLExpr;
import com.chenyang.druid.sql.ast.expr.SQLIntegerExpr;
import com.chenyang.druid.sql.dialect.sqlserver.visitor.SQLServerASTVisitor;

public class SQLServerTop extends SQLServerObjectImpl {
   private SQLExpr expr;
   private boolean percent;
   private boolean withTies;

   public SQLServerTop() {
   }

   public SQLServerTop(SQLExpr expr) {
      this.setExpr(expr);
   }

   public SQLExpr getExpr() {
      return this.expr;
   }

   public void setExpr(SQLExpr expr) {
      if (expr != null) {
         expr.setParent(this);
      }

      this.expr = expr;
   }

   public void setExpr(int expr) {
      this.setExpr(new SQLIntegerExpr(expr));
   }

   public boolean isPercent() {
      return this.percent;
   }

   public void setPercent(boolean percent) {
      this.percent = percent;
   }

   public boolean isWithTies() {
      return this.withTies;
   }

   public void setWithTies(boolean withTies) {
      this.withTies = withTies;
   }

   public void accept0(SQLServerASTVisitor visitor) {
      visitor.visit(this);
      visitor.endVisit(this);
   }

   public SQLServerTop clone() {
      SQLServerTop x = new SQLServerTop();
      if (this.expr != null) {
         x.setExpr(this.expr.clone());
      }

      x.percent = this.percent;
      x.withTies = this.withTies;
      return x;
   }
}
