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

import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.statement.SQLAlterTableItem;
import com.alibaba.druid.sql.dialect.postgresql.ast.PGSQLObject;
import com.alibaba.druid.sql.dialect.postgresql.ast.PGSQLObjectImpl;
import com.alibaba.druid.sql.dialect.postgresql.visitor.PGASTVisitor;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;

public class PGAlterTableOf extends PGSQLObjectImpl implements SQLAlterTableItem, PGSQLObject {
   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((PGASTVisitor)visitor);
   }

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

      visitor.endVisit(this);
   }

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