|
|
|
@ -307,7 +307,34 @@ public class NBA implements Iterable<NBA_State> { |
|
|
|
out.println("--END--"); |
|
|
|
} |
|
|
|
|
|
|
|
// public void print_dot(std::ostream& out); |
|
|
|
/** Print the NBA as a Graphviz (DOT) graph to out */ |
|
|
|
public void print_dot(PrintStream out) { |
|
|
|
out.println("digraph nba {"); |
|
|
|
out.println(" node [fontname=Helvetica]"); |
|
|
|
out.println(" edge [constraints=false, fontname=Helvetica]"); |
|
|
|
|
|
|
|
for (NBA_State state : _index) { |
|
|
|
out.print(" " + state.getName()); // id |
|
|
|
out.print(" [shape="); |
|
|
|
out.print((state.isFinal() ? "box" : "circle")); |
|
|
|
if (state == getStartState()) { |
|
|
|
out.print(", style=filled, color=black, fillcolor=grey"); |
|
|
|
} |
|
|
|
out.println("]"); |
|
|
|
|
|
|
|
for (Map.Entry<APElement, MyBitSet> edge : state) { |
|
|
|
APElement label = edge.getKey(); |
|
|
|
//String labelString = "["+label.toStringHOA(_apset.size())+"]"; |
|
|
|
String labelString = label.toString(getAPSet(),true); |
|
|
|
MyBitSet to_states = edge.getValue(); |
|
|
|
for (Integer to : to_states) { |
|
|
|
out.print(" " + state.getName() + " -> " + to); |
|
|
|
out.println(" [label=\"" + labelString + "\"]"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
out.println("}"); |
|
|
|
} |
|
|
|
|
|
|
|
/** Return number of states. */ |
|
|
|
public int getStateCount() |
|
|
|
|