diff options
Diffstat (limited to 'test/uk/ac/ox/cs/pagoda/tester/Statistics.java')
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/tester/Statistics.java | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/test/uk/ac/ox/cs/pagoda/tester/Statistics.java b/test/uk/ac/ox/cs/pagoda/tester/Statistics.java deleted file mode 100644 index 13d7f90..0000000 --- a/test/uk/ac/ox/cs/pagoda/tester/Statistics.java +++ /dev/null | |||
| @@ -1,60 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.tester; | ||
| 2 | |||
| 3 | import java.io.File; | ||
| 4 | import java.io.FileNotFoundException; | ||
| 5 | import java.util.Iterator; | ||
| 6 | import java.util.LinkedList; | ||
| 7 | import java.util.Scanner; | ||
| 8 | |||
| 9 | @Deprecated | ||
| 10 | public class Statistics { | ||
| 11 | |||
| 12 | double satCheckTime; | ||
| 13 | double preprocessTime; | ||
| 14 | LinkedList<Integer> number = new LinkedList<Integer>(); | ||
| 15 | LinkedList<Double> time = new LinkedList<Double>(); | ||
| 16 | |||
| 17 | public Statistics(String file) { | ||
| 18 | Scanner scanner = null; | ||
| 19 | try { | ||
| 20 | scanner = new Scanner(new File(file)); | ||
| 21 | for (String line; scanner.hasNextLine(); ) { | ||
| 22 | line = scanner.nextLine(); | ||
| 23 | if (line.contains("time for satisfiability checking")) | ||
| 24 | satCheckTime = Double.parseDouble(line.substring(line.indexOf(": ") + 2)); | ||
| 25 | else if (line.contains("Preprocessing Done in")) | ||
| 26 | preprocessTime = Double.parseDouble(line.substring(line.indexOf("in ") + 3, line.indexOf(" second"))); | ||
| 27 | else if (line.contains("The number of answer tuples:")) | ||
| 28 | number.add(Integer.parseInt(line.substring(line.indexOf(": ") + 2))); | ||
| 29 | else if (line.contains("Total time to answer this query:")) | ||
| 30 | time.add(Double.parseDouble(line.substring(line.indexOf(": ") + 2))); | ||
| 31 | } | ||
| 32 | } catch (FileNotFoundException e) { | ||
| 33 | e.printStackTrace(); | ||
| 34 | } finally { | ||
| 35 | if (scanner != null) | ||
| 36 | scanner.close(); | ||
| 37 | } | ||
| 38 | } | ||
| 39 | |||
| 40 | public String diff(String other) { | ||
| 41 | return diff(new Statistics(other)); | ||
| 42 | } | ||
| 43 | |||
| 44 | public String diff(Statistics other) { | ||
| 45 | if (other.number.size() != number.size()) | ||
| 46 | return "The number of query is different! " + this.number.size() + " v.s. " + other.number.size(); | ||
| 47 | int i = 0; | ||
| 48 | Iterator<Integer> iter1 = number.iterator(), iter2 = other.number.iterator(); | ||
| 49 | StringBuilder diff = new StringBuilder(); | ||
| 50 | int a, b; | ||
| 51 | while (iter1.hasNext()) { | ||
| 52 | ++i; | ||
| 53 | if ((a = iter1.next()) != (b = iter2.next())) { | ||
| 54 | diff.append("Query ").append(i).append(": ").append(a).append(", reference ").append(b).append("\n"); | ||
| 55 | } | ||
| 56 | } | ||
| 57 | return diff.toString(); | ||
| 58 | } | ||
| 59 | |||
| 60 | } | ||
