| 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 |
|
package org.sat4j.minisat.core; |
| 26 |
|
|
| 27 |
|
import java.io.FileWriter; |
| 28 |
|
import java.io.IOException; |
| 29 |
|
import java.io.Writer; |
| 30 |
|
|
| 31 |
|
import org.sat4j.core.Vec; |
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
@author |
| 41 |
|
|
| 42 |
|
|
|
|
|
| 0% |
Uncovered Elements: 59 (59) |
Complexity: 6 |
Complexity Density: 0,51 |
|
| 43 |
|
public class DotSearchListener implements SearchListener { |
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
private static final long serialVersionUID = 1L; |
| 49 |
|
|
| 50 |
|
private final Vec<String> pile; |
| 51 |
|
|
| 52 |
|
private String currentNodeName = null; |
| 53 |
|
|
| 54 |
|
private transient Writer out; |
| 55 |
|
|
| 56 |
|
private boolean estOrange = false; |
| 57 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0,5 |
|
| 58 |
0
|
public DotSearchListener(final String fileNameToSave) {... |
| 59 |
0
|
pile = new Vec<String>(); |
| 60 |
0
|
try { |
| 61 |
0
|
out = new FileWriter(fileNameToSave); |
| 62 |
|
} catch (IOException e) { |
| 63 |
0
|
System.err.println("Problem when created file."); |
| 64 |
|
} |
| 65 |
|
} |
| 66 |
|
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0,2 |
|
| 67 |
0
|
public final void assuming(final int p) {... |
| 68 |
0
|
final Integer absP = Math.abs(p); |
| 69 |
0
|
String newName; |
| 70 |
|
|
| 71 |
0
|
if (currentNodeName == null) { |
| 72 |
0
|
newName = absP.toString(); |
| 73 |
0
|
pile.push(newName); |
| 74 |
0
|
saveLine(lineTab("\"" + newName + "\"" + "[label=\"" + newName |
| 75 |
|
+ "\", shape=circle, color=blue, style=filled]")); |
| 76 |
|
} else { |
| 77 |
0
|
newName = currentNodeName; |
| 78 |
0
|
pile.push(newName); |
| 79 |
0
|
saveLine(lineTab("\"" + newName + "\"" + "[label=\"" |
| 80 |
|
+ absP.toString() |
| 81 |
|
+ "\", shape=circle, color=blue, style=filled]")); |
| 82 |
|
} |
| 83 |
0
|
currentNodeName = newName; |
| 84 |
|
} |
| 85 |
|
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0,25 |
|
| 86 |
0
|
public final void propagating(final int p) {... |
| 87 |
0
|
String newName = currentNodeName + "." + p; |
| 88 |
|
|
| 89 |
0
|
if (currentNodeName == null) { |
| 90 |
0
|
saveLine(lineTab("\"null\" [label=\"\", shape=point]")); |
| 91 |
|
} |
| 92 |
0
|
final String couleur = estOrange ? "orange" : "green"; |
| 93 |
|
|
| 94 |
0
|
saveLine(lineTab("\"" + newName + "\"" + "[label=\"" |
| 95 |
|
+ Integer.toString(p) + "\",shape=point, color=black]")); |
| 96 |
0
|
saveLine(lineTab("\"" + currentNodeName + "\"" + " -- " + "\"" |
| 97 |
|
+ newName + "\"" + "[label=" + "\" " + Integer.toString(p) |
| 98 |
|
+ "\", fontcolor =" + couleur + ", color = " + couleur |
| 99 |
|
+ ", style = bold]")); |
| 100 |
0
|
currentNodeName = newName; |
| 101 |
0
|
estOrange = false; |
| 102 |
|
} |
| 103 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
|
| 104 |
0
|
public final void backtracking(final int p) {... |
| 105 |
0
|
final String temp = pile.last(); |
| 106 |
0
|
pile.pop(); |
| 107 |
0
|
saveLine("\"" + temp + "\"" + "--" + "\"" + currentNodeName + "\"" |
| 108 |
|
+ "[label=\"\", color=red, style=dotted]"); |
| 109 |
0
|
currentNodeName = temp; |
| 110 |
|
} |
| 111 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 112 |
0
|
public final void adding(final int p) {... |
| 113 |
0
|
estOrange = true; |
| 114 |
|
} |
| 115 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 116 |
0
|
public final void learn(final Constr clause) {... |
| 117 |
|
} |
| 118 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 119 |
0
|
public final void delete(final int[] clause) {... |
| 120 |
|
} |
| 121 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 122 |
0
|
public final void conflictFound() {... |
| 123 |
0
|
saveLine(lineTab("\"" + currentNodeName |
| 124 |
|
+ "\" [label=\"\", shape=box, color=\"red\", style=filled]")); |
| 125 |
|
} |
| 126 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 127 |
0
|
public final void solutionFound() {... |
| 128 |
0
|
saveLine(lineTab("\"" + currentNodeName |
| 129 |
|
+ "\" [label=\"\", shape=box, color=\"green\", style=filled]")); |
| 130 |
|
} |
| 131 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 132 |
0
|
public final void beginLoop() {... |
| 133 |
|
} |
| 134 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 135 |
0
|
public final void start() {... |
| 136 |
0
|
saveLine("graph G {"); |
| 137 |
|
} |
| 138 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 139 |
0
|
public final void end(Lbool result) {... |
| 140 |
0
|
saveLine("}"); |
| 141 |
|
} |
| 142 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 143 |
0
|
private final String lineTab(final String line) {... |
| 144 |
0
|
return "\t" + line; |
| 145 |
|
} |
| 146 |
|
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 3 |
Complexity Density: 0,6 |
|
| 147 |
0
|
private final void saveLine(final String line) {... |
| 148 |
0
|
try { |
| 149 |
0
|
out.write(line + '\n'); |
| 150 |
0
|
if ("}".equals(line)) { |
| 151 |
0
|
out.close(); |
| 152 |
|
} |
| 153 |
|
} catch (IOException e) { |
| 154 |
0
|
e.printStackTrace(); |
| 155 |
|
} |
| 156 |
|
} |
| 157 |
|
} |