39 lines
893 B
Java
39 lines
893 B
Java
package ch.usi.inf.sp.cfg.builder;
|
|
|
|
import org.objectweb.asm.tree.AbstractInsnNode;
|
|
import org.objectweb.asm.tree.LabelNode;
|
|
import org.objectweb.asm.tree.TableSwitchInsnNode;
|
|
|
|
public class TableSwitchInstructionNodeInfo implements SwitchInstructionNodeInfo {
|
|
private final TableSwitchInsnNode node;
|
|
|
|
public TableSwitchInstructionNodeInfo(TableSwitchInsnNode node) {
|
|
this.node = node;
|
|
}
|
|
|
|
@Override
|
|
public AbstractInsnNode getNode() {
|
|
return node;
|
|
}
|
|
|
|
@Override
|
|
public int getCaseCount() {
|
|
return node.labels.size();
|
|
}
|
|
|
|
@Override
|
|
public LabelNode getLabelForCase(int index) {
|
|
return node.labels.get(index);
|
|
}
|
|
|
|
@Override
|
|
public String getKeyForCase(int index) {
|
|
return Integer.toString(node.min + index);
|
|
}
|
|
|
|
@Override
|
|
public LabelNode getDefaultCase() {
|
|
return node.dflt;
|
|
}
|
|
}
|