Split methods
This commit is contained in:
parent
5ea988992a
commit
47bff81942
1 changed files with 15 additions and 16 deletions
|
@ -123,22 +123,21 @@ public class CFG {
|
|||
return res;
|
||||
}
|
||||
|
||||
private String node2str(Node s) {
|
||||
if (s == beginNode)
|
||||
return "Start";
|
||||
if (s == endNode)
|
||||
return "Stop";
|
||||
int index = -1;
|
||||
for (int i = 0; i < nodes.size(); i++) {
|
||||
if (nodes.get(i) == s) {
|
||||
index = i;
|
||||
break;
|
||||
private String node2str(Node n) {
|
||||
if (n == beginNode) return "Start";
|
||||
if (n == endNode) return "Stop";
|
||||
return String.format("\"(%d, %d) %s\"", indexOfNode(n) + 1, n.getRange().get().begin.line, escape(n.toString()));
|
||||
}
|
||||
|
||||
private int indexOfNode(Node n) {
|
||||
for (int i = 0; i < nodes.size(); i++)
|
||||
if (nodes.get(i) == n)
|
||||
return i;
|
||||
throw new RuntimeException("Internal error, can't find node in list");
|
||||
}
|
||||
if (index == -1)
|
||||
throw new RuntimeException("Internal error, can't find node");
|
||||
return "\"(" + (index + 1) + ", " + s.getRange().get().begin.line + ") "
|
||||
+ s.toString().replace("\"", "\\\"") + "\"";
|
||||
|
||||
private String escape(String s) {
|
||||
return s.replace("\"", "\\\"");
|
||||
}
|
||||
|
||||
private static int clusterId = 0;
|
||||
|
|
Loading…
Reference in a new issue