package de.dhbwstuttgart.syntaxtree.statement; import java.util.ArrayList; import java.util.List; import org.antlr.v4.runtime.Token; import de.dhbwstuttgart.syntaxtree.StatementVisitor; public class SwitchBlock extends Block { private List labels = new ArrayList<>(); private boolean defaultBlock = false; public final boolean isExpression; // This is for single expressions that yield a value public SwitchBlock(List labels, Block statements, boolean isExpression, Token offset) { super(statements.getStatements(), offset); this.labels = labels; this.isExpression = isExpression; } public SwitchBlock(List labels, Block statements, boolean isDefault, boolean isExpression, Token offset) { super(statements.getStatements(), offset); this.labels = labels; this.defaultBlock = isDefault; this.isExpression = isExpression; } public boolean isDefault() { return defaultBlock; } public List getLabels() { return labels; } @Override public void accept(StatementVisitor visitor) { visitor.visit(this); } }