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.DB2SQLObject;
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;

public class DB2AlterTableOf extends DB2SQLObjectImpl implements SQLAlterTableItem, DB2SQLObject {
   private boolean of;
   private boolean isOwn;
   private boolean notOf;
   private SQLExpr typeName;
   private SQLExpr newOwner;

   public boolean isOf() {
      return this.of;
   }

   public void setOf(boolean of) {
      this.of = of;
   }

   public boolean isNotOf() {
      return this.notOf;
   }

   public void setNotOf(boolean notOf) {
      this.notOf = notOf;
   }

   public SQLExpr getTypeName() {
      return this.typeName;
   }

   public void setTypeName(SQLExpr typeName) {
      this.typeName = typeName;
      typeName.setParent(this);
   }

   public boolean isOwn() {
      return this.isOwn;
   }

   public void setOwn(boolean own) {
      this.isOwn = own;
   }

   public SQLExpr getNewOwner() {
      return this.newOwner;
   }

   public void setNewOwner(SQLExpr newOwner) {
      this.newOwner = newOwner;
      newOwner.setParent(this);
   }

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

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

      visitor.endVisit(this);
   }

   public DB2AlterTableOf clone() {
      DB2AlterTableOf c = new DB2AlterTableOf();
      c.of = this.of;
      c.notOf = this.notOf;
      c.isOwn = this.isOwn;
      if (this.typeName != null) {
         c.setTypeName(this.typeName.clone());
      }

      if (this.newOwner != null) {
         c.setNewOwner(this.newOwner.clone());
      }

      return c;
   }
}
