Changeset 29


Ignore:
Timestamp:
04/14/11 15:51:47 (13 years ago)
Author:
sherbold
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/FirstOrderMarkovModel.java

    r25 r29  
    66 
    77import de.ugoe.cs.eventbench.data.Event; 
     8import de.ugoe.cs.util.StringTools; 
    89import de.ugoe.cs.util.console.Console; 
    910import edu.uci.ics.jung.graph.Graph; 
     
    4142        public String getDotRepresentation() { 
    4243                StringBuilder stringBuilder = new StringBuilder(); 
    43                 stringBuilder.append("digraph model {"); 
     44                stringBuilder.append("digraph model {" + StringTools.ENDLINE); 
    4445 
    4546                List<Event<?>> knownSymbols = new ArrayList<Event<?>>(trie.getKnownSymbols()); 
     
    4748                for( Event<?> symbol : knownSymbols) { 
    4849                        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); 
    5051                        List<Event<?>> context = new ArrayList<Event<?>>(); 
    5152                        context.add(symbol);  
    5253                        List<Event<?>> followers = trie.getFollowingSymbols(context); 
    5354                        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); 
    5657                        } 
    5758                } 
    58                 stringBuilder.append('}'); 
     59                stringBuilder.append('}' + StringTools.ENDLINE); 
    5960                return stringBuilder.toString(); 
    6061        } 
Note: See TracChangeset for help on using the changeset viewer.