package com.chenyang.druid.sql.dialect.kingbase;

import com.chenyang.druid.sql.SQLUtils;
import com.chenyang.druid.sql.ast.SQLDataType;
import com.chenyang.druid.sql.ast.SQLObject;
import com.chenyang.druid.sql.ast.SQLObjectImpl;
import com.chenyang.druid.sql.dialect.kingbase.visitor.KingbaseASTVisitor;
import com.chenyang.druid.sql.visitor.SQLASTOutputVisitor;
import com.chenyang.druid.sql.visitor.SQLASTVisitor;
import java.util.List;

public abstract class KingbaseSQLObjectImpl extends SQLObjectImpl implements KingbaseSQLObject {
   protected void accept0(SQLASTVisitor v) {
      if (v instanceof KingbaseASTVisitor) {
         this.accept0((KingbaseASTVisitor)v);
      } else {
         if (v instanceof SQLASTOutputVisitor) {
            ((SQLASTOutputVisitor)v).print(this.toString());
         }

      }
   }

   public abstract void accept0(KingbaseASTVisitor var1);

   public SQLObject clone() {
      throw new UnsupportedOperationException(this.getClass().getName());
   }

   public SQLDataType computeDataType() {
      return null;
   }

   public String toString() {
      return SQLUtils.toOracleString(this);
   }

   protected void visitChild(SQLObject x, SQLASTVisitor visitor) {
      if (x != null) {
         x.accept(visitor);
      }

   }

   protected void visitChild(List<? extends SQLObject> x, SQLASTVisitor visitor) {
      if (x != null && x.size() > 0) {
         for(SQLObject c : x) {
            c.accept(visitor);
         }
      }

   }
}
