package com.chenyang.druid.sql.ast.statement;

import com.chenyang.druid.DbType;
import com.chenyang.druid.sql.ast.SQLName;
import com.chenyang.druid.sql.ast.SQLObject;
import com.chenyang.druid.sql.ast.SQLStatementImpl;
import com.chenyang.druid.sql.visitor.SQLASTVisitor;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class SQLAlterDatabaseStatement extends SQLStatementImpl implements SQLAlterStatement {
   private SQLName name;
   private boolean upgradeDataDirectoryName;
   private SQLAlterCharacter character;
   private SQLAlterDatabaseItem item;
   private List<SQLAssignItem> properties = new ArrayList();

   public SQLAlterDatabaseStatement() {
   }

   public SQLAlterDatabaseStatement(DbType dbType) {
      this.setDbType(dbType);
   }

   public SQLName getName() {
      return this.name;
   }

   public void setName(SQLName name) {
      if (name != null) {
         name.setParent(this);
      }

      this.name = name;
   }

   public SQLAlterCharacter getCharacter() {
      return this.character;
   }

   public void setCharacter(SQLAlterCharacter character) {
      if (character != null) {
         character.setParent(this);
      }

      this.character = character;
   }

   public boolean isUpgradeDataDirectoryName() {
      return this.upgradeDataDirectoryName;
   }

   public void setUpgradeDataDirectoryName(boolean upgradeDataDirectoryName) {
      this.upgradeDataDirectoryName = upgradeDataDirectoryName;
   }

   protected void accept0(SQLASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.name);
      }

      visitor.endVisit(this);
   }

   public SQLAlterDatabaseItem getItem() {
      return this.item;
   }

   public void setItem(SQLAlterDatabaseItem item) {
      this.item = item;
   }

   public List<SQLAssignItem> getProperties() {
      return this.properties;
   }

   public List<SQLObject> getChildren() {
      return Collections.singletonList(this.name);
   }
}
