package com.alibaba.druid.sql.dialect.oracle.ast.stmt;

import com.alibaba.druid.sql.ast.SQLName;
import com.alibaba.druid.sql.ast.statement.SQLTableElement;
import com.alibaba.druid.sql.dialect.oracle.ast.OracleSQLObjectImpl;
import com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor;
import java.util.ArrayList;
import java.util.List;

public class OracleSupplementalLogGrp extends OracleSQLObjectImpl implements SQLTableElement {
   private SQLName group;
   private List<SQLName> columns = new ArrayList();
   private boolean always = false;

   public void accept0(OracleASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.group);
         this.acceptChild(visitor, this.columns);
      }

      visitor.endVisit(this);
   }

   public SQLName getGroup() {
      return this.group;
   }

   public void setGroup(SQLName group) {
      if (group != null) {
         group.setParent(this);
      }

      this.group = group;
   }

   public List<SQLName> getColumns() {
      return this.columns;
   }

   public void addColumn(SQLName column) {
      if (column != null) {
         column.setParent(this);
      }

      this.columns.add(column);
   }

   public boolean isAlways() {
      return this.always;
   }

   public void setAlways(boolean always) {
      this.always = always;
   }

   public OracleSupplementalLogGrp clone() {
      OracleSupplementalLogGrp x = new OracleSupplementalLogGrp();
      if (this.group != null) {
         x.setGroup(this.group.clone());
      }

      for(SQLName column : this.columns) {
         SQLName c2 = column.clone();
         c2.setParent(x);
         x.columns.add(c2);
      }

      x.always = this.always;
      return x;
   }
}
