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

import com.alibaba.druid.sql.ast.SQLCommentHint;
import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.dialect.dm.visitor.DmASTVisitor;
import java.util.ArrayList;
import java.util.List;

public class DmExitStatement extends DmStatementImpl {
   private String label;
   private SQLExpr when;

   public SQLExpr getWhen() {
      return this.when;
   }

   public void setWhen(SQLExpr when) {
      if (when != null) {
         when.setParent(this);
      }

      this.when = when;
   }

   public void accept0(DmASTVisitor visitor) {
      if (visitor.visit(this)) {
      }

      visitor.endVisit(this);
   }

   public String getLabel() {
      return this.label;
   }

   public void setLabel(String label) {
      this.label = label;
   }

   public DmExitStatement clone() {
      DmExitStatement x = new DmExitStatement();
      x.setLabel(this.label);
      x.setAfterSemi(this.afterSemi);
      x.setDbType(this.dbType);
      if (this.when != null) {
         x.setWhen(this.when.clone());
      }

      if (this.headHints != null) {
         List<SQLCommentHint> headHintsClone = new ArrayList(this.headHints.size());

         for(SQLCommentHint hint : this.headHints) {
            SQLCommentHint h2 = hint.clone();
            h2.setParent(x);
            headHintsClone.add(h2);
         }

         x.setHeadHints(headHintsClone);
      }

      return x;
   }
}
