blob: 13d7f90fc73a1326a8825c3954e8009c15d49fda (
plain) (
blame)
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
55
56
57
58
59
60
|
package uk.ac.ox.cs.pagoda.tester;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Scanner;
@Deprecated
public class Statistics {
double satCheckTime;
double preprocessTime;
LinkedList<Integer> number = new LinkedList<Integer>();
LinkedList<Double> time = new LinkedList<Double>();
public Statistics(String file) {
Scanner scanner = null;
try {
scanner = new Scanner(new File(file));
for (String line; scanner.hasNextLine(); ) {
line = scanner.nextLine();
if (line.contains("time for satisfiability checking"))
satCheckTime = Double.parseDouble(line.substring(line.indexOf(": ") + 2));
else if (line.contains("Preprocessing Done in"))
preprocessTime = Double.parseDouble(line.substring(line.indexOf("in ") + 3, line.indexOf(" second")));
else if (line.contains("The number of answer tuples:"))
number.add(Integer.parseInt(line.substring(line.indexOf(": ") + 2)));
else if (line.contains("Total time to answer this query:"))
time.add(Double.parseDouble(line.substring(line.indexOf(": ") + 2)));
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} finally {
if (scanner != null)
scanner.close();
}
}
public String diff(String other) {
return diff(new Statistics(other));
}
public String diff(Statistics other) {
if (other.number.size() != number.size())
return "The number of query is different! " + this.number.size() + " v.s. " + other.number.size();
int i = 0;
Iterator<Integer> iter1 = number.iterator(), iter2 = other.number.iterator();
StringBuilder diff = new StringBuilder();
int a, b;
while (iter1.hasNext()) {
++i;
if ((a = iter1.next()) != (b = iter2.next())) {
diff.append("Query ").append(i).append(": ").append(a).append(", reference ").append(b).append("\n");
}
}
return diff.toString();
}
}
|