package com.alibaba.druid.sql.dialect.gauss.ast.expr.tablesource;

import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.SQLHint;
import com.alibaba.druid.sql.ast.SQLParameter;
import com.alibaba.druid.sql.ast.statement.SQLExprTableSource;
import com.alibaba.druid.sql.dialect.gauss.ast.GaussSQLObject;
import com.alibaba.druid.sql.dialect.gauss.visitor.GaussASTVisitor;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
import java.util.ArrayList;
import java.util.List;

public class GaussFunctionTableSource extends SQLExprTableSource implements GaussSQLObject {
   private final List<SQLParameter> parameters = new ArrayList();

   public GaussFunctionTableSource() {
   }

   public GaussFunctionTableSource(SQLExpr expr) {
      this.expr = expr;
   }

   public List<SQLParameter> getParameters() {
      return this.parameters;
   }

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

   public void accept0(GaussASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.expr);
         this.acceptChild(visitor, this.parameters);
      }

      visitor.endVisit(this);
   }

   public GaussFunctionTableSource clone() {
      GaussFunctionTableSource x = new GaussFunctionTableSource();
      x.setAlias(this.alias);

      for(SQLParameter e : this.parameters) {
         SQLParameter e2 = e.clone();
         e2.setParent(x);
         x.getParameters().add(e2);
      }

      if (this.flashback != null) {
         x.setFlashback(this.flashback.clone());
      }

      if (this.hints != null) {
         for(SQLHint e : this.hints) {
            SQLHint e2 = e.clone();
            e2.setParent(x);
            x.getHints().add(e2);
         }
      }

      return x;
   }
}
