package com.chenyang.druid.sql.dialect.db2.ast.stmt.alterTable;

import com.chenyang.druid.sql.ast.SQLExpr;
import com.chenyang.druid.sql.ast.statement.SQLAlterTableItem;
import com.chenyang.druid.sql.dialect.db2.ast.DB2SQLObjectImpl;
import com.chenyang.druid.sql.dialect.db2.visitor.DB2ASTVisitor;
import com.chenyang.druid.sql.visitor.SQLASTVisitor;
import java.util.ArrayList;
import java.util.List;

public class DB2AlterTableAlterColumnOptions extends DB2SQLObjectImpl implements SQLAlterTableItem {
   private boolean set = false;
   private List<DB2AlterTableAlterColumnOptionValue> options = new ArrayList();

   public boolean isSet() {
      return this.set;
   }

   public void setSet(boolean set) {
      this.set = set;
   }

   public List<DB2AlterTableAlterColumnOptionValue> getOptions() {
      return this.options;
   }

   public void setOptions(List<DB2AlterTableAlterColumnOptionValue> options) {
      this.options = options;
   }

   public void addOption(DB2AlterTableAlterColumnOptionValue option) {
      this.options.add(option);
      option.setParent(this);
   }

   public void accept0(SQLASTVisitor visitor) {
      this.accept0((DB2ASTVisitor)visitor);
   }

   public void accept0(DB2ASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.options);
      }

      visitor.endVisit(this);
   }

   public DB2AlterTableAlterColumnOptions clone() {
      DB2AlterTableAlterColumnOptions c = new DB2AlterTableAlterColumnOptions();
      c.set = this.set;

      for(DB2AlterTableAlterColumnOptionValue option : this.options) {
         c.addOption(option.clone());
      }

      return c;
   }

   public static class DB2AlterTableAlterColumnOptionValue extends DB2SQLObjectImpl {
      private SQLExpr attribute;
      private SQLExpr value;

      public SQLExpr getAttribute() {
         return this.attribute;
      }

      public void setAttribute(SQLExpr attribute) {
         this.attribute = attribute;
         attribute.setParent(this);
      }

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

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

      public void accept0(SQLASTVisitor visitor) {
         this.accept0((DB2ASTVisitor)visitor);
      }

      public void accept0(DB2ASTVisitor visitor) {
         if (visitor.visit(this)) {
            this.acceptChild(visitor, this.attribute);
            this.acceptChild(visitor, this.value);
         }

         visitor.endVisit(this);
      }

      public DB2AlterTableAlterColumnOptionValue clone() {
         DB2AlterTableAlterColumnOptionValue option = new DB2AlterTableAlterColumnOptionValue();
         option.setAttribute(this.attribute.clone());
         if (this.value != null) {
            option.setValue(this.value.clone());
         }

         return option;
      }
   }
}
