package com.alibaba.druid.sql.dialect.greenplum.ast.stmt.alterTable;

import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.statement.SQLAlterTableItem;
import com.alibaba.druid.sql.dialect.greenplum.ast.GPSQLObject;
import com.alibaba.druid.sql.dialect.greenplum.ast.GPSQLObjectImpl;
import com.alibaba.druid.sql.dialect.greenplum.visitor.GPASTVisitor;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;

public class GPAlterTableOf extends GPSQLObjectImpl implements SQLAlterTableItem, GPSQLObject {
   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((GPASTVisitor)visitor);
   }

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

      visitor.endVisit(this);
   }

   public GPAlterTableOf clone() {
      GPAlterTableOf c = new GPAlterTableOf();
      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;
   }
}
