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

import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLDataType;
import com.alibaba.druid.sql.ast.SQLObject;
import com.alibaba.druid.sql.ast.SQLObjectImpl;
import com.alibaba.druid.sql.dialect.kingbase.visitor.KingbaseASTVisitor;
import com.alibaba.druid.sql.visitor.SQLASTOutputVisitor;
import com.alibaba.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);
         }
      }

   }
}
