package com.alibaba.druid.sql.dialect.mariadb.ast.expr;

import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.SQLExprImpl;
import com.alibaba.druid.sql.dialect.mariadb.visitor.MariadbASTVisitor;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;

public class MariadbIntervalExpr extends SQLExprImpl {
   private SQLExpr value;
   private SQLExpr unit;

   public boolean equals(Object o) {
      if (o == null) {
         return false;
      } else if (!o.getClass().equals(MariadbIntervalExpr.class)) {
         return false;
      } else {
         return o == this;
      }
   }

   public int hashCode() {
      return this.value.hashCode() + this.unit.hashCode();
   }

   protected void accept0(SQLASTVisitor v) {
      if (v instanceof MariadbASTVisitor) {
         MariadbASTVisitor visitor = (MariadbASTVisitor)v;
         if (visitor.visit(this)) {
            this.acceptChild(visitor, this.value);
            this.acceptChild(visitor, this.unit);
         }

         visitor.endVisit(this);
      }

   }

   public SQLExpr clone() {
      MariadbIntervalExpr expr = new MariadbIntervalExpr();
      expr.value = this.value.clone();
      expr.unit = this.unit.clone();
      return expr;
   }

   public SQLExpr getValue() {
      return this.value;
   }

   public void setValue(SQLExpr value) {
      value.setParent(this);
      this.value = value;
   }

   public SQLExpr getUnit() {
      return this.unit;
   }

   public void setUnit(SQLExpr unit) {
      this.unit = unit;
   }
}
