45 lines
821 B
Java
45 lines
821 B
Java
package ch.usi.inf.sp.cfg;
|
|
|
|
import ch.usi.inf.sp.graph.Node;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
public final class BasicBlock extends Node<ControlFlowEdge> {
|
|
|
|
private final int id;
|
|
private final ArrayList<String> instructions;
|
|
|
|
|
|
public BasicBlock(final int id) {
|
|
this.id = id;
|
|
instructions = new ArrayList<String>();
|
|
}
|
|
|
|
public void appendInstruction(final String s) {
|
|
instructions.add(s);
|
|
}
|
|
|
|
public int getId() {
|
|
return id;
|
|
}
|
|
|
|
public int getInstructionCount() {
|
|
return instructions.size();
|
|
}
|
|
|
|
public String getInstruction(int i) {
|
|
return instructions.get(i);
|
|
}
|
|
|
|
public Iterable<String> getInstructions() {
|
|
return instructions;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "\""+id+"\"";
|
|
}
|
|
|
|
}
|