package com.alibaba.druid.sql.dialect.postgresql.ast.expr;

import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.SQLObject;
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;
import java.util.ArrayList;
import java.util.List;

public class PGOptionValue extends PGSQLObjectImpl implements SQLExpr {
   protected SQLExpr option;
   protected SQLExpr value;
   private boolean eq = false;

   public boolean isEq() {
      return this.eq;
   }

   public void setEq(boolean eq) {
      this.eq = eq;
   }

   public SQLExpr getOption() {
      return this.option;
   }

   public void setOption(SQLExpr option) {
      this.option = option;
   }

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

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

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

   public void accept0(PGASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.option);
         if (this.value != null) {
            this.acceptChild(visitor, this.value);
         }
      }

      visitor.endVisit(this);
   }

   public void cloneTo(PGOptionValue c) {
      c.setOption(this.option.clone());
      if (this.value != null) {
         c.setValue(this.value.clone());
      }

   }

   public PGOptionValue clone() {
      PGOptionValue c = new PGOptionValue();
      this.cloneTo(c);
      return c;
   }

   public List<SQLObject> getChildren() {
      List<SQLObject> c = new ArrayList();
      c.add(this.option);
      if (this.value != null) {
         c.add(this.value);
      }

      return c;
   }
}
