package com.chenyang.druid.sql.dialect.oracle.ast.clause;

import com.chenyang.druid.sql.ast.statement.SQLWithSubqueryClause;
import com.chenyang.druid.sql.dialect.oracle.ast.OracleSQLObject;
import com.chenyang.druid.sql.dialect.oracle.visitor.OracleASTVisitor;
import com.chenyang.druid.sql.visitor.SQLASTVisitor;

public class OracleWithSubqueryEntry extends SQLWithSubqueryClause.Entry implements OracleSQLObject {
   private SearchClause searchClause;
   private CycleClause cycleClause;

   public CycleClause getCycleClause() {
      return this.cycleClause;
   }

   public void setCycleClause(CycleClause cycleClause) {
      if (cycleClause != null) {
         cycleClause.setParent(this);
      }

      this.cycleClause = cycleClause;
   }

   public SearchClause getSearchClause() {
      return this.searchClause;
   }

   public void setSearchClause(SearchClause searchClause) {
      if (searchClause != null) {
         searchClause.setParent(this);
      }

      this.searchClause = searchClause;
   }

   public void accept0(OracleASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.columns);
         this.acceptChild(visitor, this.subQuery);
         this.acceptChild(visitor, this.searchClause);
         this.acceptChild(visitor, this.cycleClause);
      }

      visitor.endVisit(this);
   }

   protected void accept0(SQLASTVisitor visitor) {
      this.accept0((OracleASTVisitor)visitor);
   }

   public void cloneTo(OracleWithSubqueryEntry x) {
      super.cloneTo(x);
      if (this.searchClause != null) {
         this.setSearchClause(this.searchClause.clone());
      }

      if (this.cycleClause != null) {
         this.setCycleClause(this.cycleClause.clone());
      }

   }

   public OracleWithSubqueryEntry clone() {
      OracleWithSubqueryEntry x = new OracleWithSubqueryEntry();
      this.cloneTo(x);
      return x;
   }
}
