MCPcopy Create free account
hub / github.com/LFYSec/MScan / LookupSwitch

Class LookupSwitch

src/main/java/pascal/taie/ir/stmt/LookupSwitch.java:31–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29import java.util.stream.IntStream;
30
31public class LookupSwitch extends SwitchStmt {
32
33 private final List<Integer> caseValues;
34
35 public LookupSwitch(Var var, List<Integer> caseValues) {
36 super(var);
37 this.caseValues = List.copyOf(caseValues);
38 }
39
40 public int getCaseValue(int index) {
41 return caseValues.get(index);
42 }
43
44 @Override
45 public List<Integer> getCaseValues() {
46 return caseValues;
47 }
48
49 @Override
50 public List<Pair<Integer, Stmt>> getCaseTargets() {
51 return IntStream.range(0, caseValues.size())
52 .mapToObj(i -> new Pair<>(caseValues.get(i),
53 targets == null ? null : targets.get(i)))
54 .toList();
55 }
56
57 @Override
58 public <T> T accept(StmtVisitor<T> visitor) {
59 return visitor.visit(this);
60 }
61
62 @Override
63 public String getInsnString() {
64 return "lookupswitch";
65 }
66}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected