forked from JavaTX/JavaCompilerCore
38 lines
907 B
Java
38 lines
907 B
Java
package de.dhbwstuttgart.syntaxtree.statement;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
import org.antlr.v4.runtime.Token;
|
|
|
|
import de.dhbwstuttgart.syntaxtree.StatementVisitor;
|
|
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
|
|
|
public class Switch extends Statement {
|
|
|
|
private Expression switchedExpression;
|
|
private List<SwitchBlock> blocks = new ArrayList<>();
|
|
|
|
public Switch(Expression switched, List<SwitchBlock> blocks, RefTypeOrTPHOrWildcardOrGeneric type, Boolean isStatement, Token offset) {
|
|
super(type, offset);
|
|
if (isStatement)
|
|
setStatement();
|
|
this.switchedExpression = switched;
|
|
this.blocks = blocks;
|
|
}
|
|
|
|
public Expression getSwitch() {
|
|
return switchedExpression;
|
|
}
|
|
|
|
public List<SwitchBlock> getBlocks() {
|
|
return blocks;
|
|
}
|
|
|
|
@Override
|
|
public void accept(StatementVisitor visitor) {
|
|
visitor.visit(this);
|
|
}
|
|
|
|
}
|