@Test public void testDotSring() { String pmaDotStr = pma.toDotString(); System.out.println(pmaDotStr); assertTrue(pmaDotStr.contains("s_0 [texlbl=\"$\\begin{array}{c}0 : 0\\end{array}$\" label=\" \"];")); assertTrue(pmaDotStr.contains("s_1 [texlbl=\"$\\begin{array}{c}1 : 1\\end{array}$\" label=\" \"];")); assertTrue(pmaDotStr.contains("s_2 [texlbl=\"$\\begin{array}{c}2 : 2\\\\ (a\\ b \\rightarrow c\\ d)\\end{array}$\" label=\" \"];")); assertTrue(pmaDotStr.contains("s_0 -> s_1 [label=\"a / 0\"];")); assertTrue(pmaDotStr.contains("s_1 -> s_2 [label=\"b / 0\"];")); }
public String toDotString() { StringBuilder sb = new StringBuilder("digraph A"); sb.append((long) (Math.random()* 2e61d)); sb.append("{\n rankdir=TB;\n node [shape=circle];\n"); for(State state : keySet()) { sb.append(" "); sb.append(state.toFullDotString()); sb.append("\n"); } for(State state : keySet()) { HashMap<Symbol, ActionState> transition = get(state); sb.append(transitionToDotString(state, transition)); } sb.append("}"); return sb.toString(); }
PatternMatchAutomaton extends LinkedHashMap<State, HashMap<Symbol, ActionState>> { public String toDotString() { StringBuilder sb = new StringBuilder("digraph A"); sb.append((long) (Math.random()* 2e61d)); sb.append("{\n rankdir=TB;\n node [shape=circle];\n"); for(State state : keySet()) { sb.append(" "); sb.append(state.toFullDotString()); sb.append("\n"); } for(State state : keySet()) { HashMap<Symbol, ActionState> transition = get(state); sb.append(transitionToDotString(state, transition)); } sb.append("}"); return sb.toString(); } }
PatternMatchAutomaton extends LinkedHashMap<State, HashMap<Symbol, ActionState>> { public String toDotString() { StringBuilder sb = new StringBuilder("digraph A"); sb.append((long) (Math.random()* 2e61d)); sb.append("{\n rankdir=TB;\n node [shape=circle];\n"); for(State state : keySet()) { sb.append(" "); sb.append(state.toFullDotString()); sb.append("\n"); } for(State state : keySet()) { HashMap<Symbol, ActionState> transition = get(state); sb.append(transitionToDotString(state, transition)); } sb.append("}"); return sb.toString(); } PatternMatchAutomaton(SRS srs);  PatternMatchAutomaton(SRS srs, Symbol[] extraTerminals);  PatternMatchAutomaton(SRS srs, Set<Symbol> extraTerminals); }
PatternMatchAutomaton extends LinkedHashMap<State, HashMap<Symbol, ActionState>> { public String toDotString() { StringBuilder sb = new StringBuilder("digraph A"); sb.append((long) (Math.random()* 2e61d)); sb.append("{\n rankdir=TB;\n node [shape=circle];\n"); for(State state : keySet()) { sb.append(" "); sb.append(state.toFullDotString()); sb.append("\n"); } for(State state : keySet()) { HashMap<Symbol, ActionState> transition = get(state); sb.append(transitionToDotString(state, transition)); } sb.append("}"); return sb.toString(); } PatternMatchAutomaton(SRS srs);  PatternMatchAutomaton(SRS srs, Symbol[] extraTerminals);  PatternMatchAutomaton(SRS srs, Set<Symbol> extraTerminals); void rewrite(SinglyLinkedList<Symbol> l); void rewrite(SpliceList<Symbol> l); @Override String toString(); String toDotString(); Map<Symbol, Integer> mkSymToNum(); String toImplString(); StringBuilder transitionToDotString(State state, Map<Symbol, ActionState> transition); }
PatternMatchAutomaton extends LinkedHashMap<State, HashMap<Symbol, ActionState>> { public String toDotString() { StringBuilder sb = new StringBuilder("digraph A"); sb.append((long) (Math.random()* 2e61d)); sb.append("{\n rankdir=TB;\n node [shape=circle];\n"); for(State state : keySet()) { sb.append(" "); sb.append(state.toFullDotString()); sb.append("\n"); } for(State state : keySet()) { HashMap<Symbol, ActionState> transition = get(state); sb.append(transitionToDotString(state, transition)); } sb.append("}"); return sb.toString(); } PatternMatchAutomaton(SRS srs);  PatternMatchAutomaton(SRS srs, Symbol[] extraTerminals);  PatternMatchAutomaton(SRS srs, Set<Symbol> extraTerminals); void rewrite(SinglyLinkedList<Symbol> l); void rewrite(SpliceList<Symbol> l); @Override String toString(); String toDotString(); Map<Symbol, Integer> mkSymToNum(); String toImplString(); StringBuilder transitionToDotString(State state, Map<Symbol, ActionState> transition);  }