- Timestamp:
- 04/14/11 15:51:47 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/FirstOrderMarkovModel.java
r25 r29 6 6 7 7 import de.ugoe.cs.eventbench.data.Event; 8 import de.ugoe.cs.util.StringTools; 8 9 import de.ugoe.cs.util.console.Console; 9 10 import edu.uci.ics.jung.graph.Graph; … … 41 42 public String getDotRepresentation() { 42 43 StringBuilder stringBuilder = new StringBuilder(); 43 stringBuilder.append("digraph model {" );44 stringBuilder.append("digraph model {" + StringTools.ENDLINE); 44 45 45 46 List<Event<?>> knownSymbols = new ArrayList<Event<?>>(trie.getKnownSymbols()); … … 47 48 for( Event<?> symbol : knownSymbols) { 48 49 final String thisSaneId = symbol.getShortId().replace("\"", "\\\"").replaceAll("[\r\n]",""); 49 stringBuilder.append(" " + symbol.hashCode() + " [label=\""+thisSaneId+"\"];" );50 stringBuilder.append(" " + symbol.hashCode() + " [label=\""+thisSaneId+"\"];" + StringTools.ENDLINE); 50 51 List<Event<?>> context = new ArrayList<Event<?>>(); 51 52 context.add(symbol); 52 53 List<Event<?>> followers = trie.getFollowingSymbols(context); 53 54 for( Event<?> follower : followers ) { 54 System.out.print(" "+symbol.hashCode()+" -> " + follower.hashCode() + " ");55 System.out.println("[label=\"" + getProbability(context, follower) + "\"];");55 stringBuilder.append(" "+symbol.hashCode()+" -> " + follower.hashCode() + " "); 56 stringBuilder.append("[label=\"" + getProbability(context, follower) + "\"];" + StringTools.ENDLINE); 56 57 } 57 58 } 58 stringBuilder.append('}' );59 stringBuilder.append('}' + StringTools.ENDLINE); 59 60 return stringBuilder.toString(); 60 61 }
Note: See TracChangeset
for help on using the changeset viewer.