Fixed labels positioning, added flexibility
This commit is contained in:
parent
e77fe8f772
commit
5ea988992a
1 changed files with 5 additions and 6 deletions
|
@ -12,9 +12,8 @@ public class CFG {
|
|||
private final Stack<Block> blockStack = new Stack<>();
|
||||
private final List<Edge> edges = new LinkedList<>();
|
||||
private final Node beginNode = new EmptyStmt(), endNode = new EmptyStmt();
|
||||
private final List<Node> nodeList = new LinkedList<>();
|
||||
|
||||
private String nextLabel;
|
||||
private final LinkedList<Node> nodeList = new LinkedList<>();
|
||||
private final Map<Node, String> labelMap = new HashMap<>();
|
||||
|
||||
private void registerNode(Node stmt) {
|
||||
nodes.add(stmt);
|
||||
|
@ -100,12 +99,12 @@ public class CFG {
|
|||
}
|
||||
|
||||
public void setNextLabel(boolean b) {
|
||||
nextLabel = String.valueOf(b);
|
||||
labelMap.put(nodeList.getLast(), String.valueOf(b));
|
||||
}
|
||||
|
||||
private void connect(Node begin, Node end) {
|
||||
edges.add(new Edge(begin, end, nextLabel));
|
||||
nextLabel = null;
|
||||
edges.add(new Edge(begin, end, labelMap.get(begin)));
|
||||
labelMap.remove(begin);
|
||||
}
|
||||
|
||||
public Node getEndNode() {
|
||||
|
|
Loading…
Reference in a new issue