-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathInducedRefinementsParser.java
More file actions
54 lines (37 loc) · 1.59 KB
/
InducedRefinementsParser.java
File metadata and controls
54 lines (37 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package liquidjava.infer;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class InducedRefinementsParser {
private static final String STARTER = "====================================================== search started:";
private static final String ENDER = "*************Summary***************";
public InducedRefinementsParser() {
// Does nothing
}
public static List<String> parseRefinements(String file) throws IOException {
List<String> result = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
String line = reader.readLine();
boolean start = false;
boolean end = false;
while ((line = reader.readLine()) != null && !end) {
if (!start) {
start = line.startsWith(STARTER);
continue;
} else end = line.startsWith(ENDER);
if (start && !end)
if (line.contains("NPC constraint")) {
line = reader.readLine();
while (line.endsWith("&&") || line.endsWith("||")) line += reader.readLine();
if (line.startsWith("%")) line = line.substring(line.indexOf("%", 2) + 1);
result.add(line);
}
}
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
}