Changeset 25 for trunk/EventBenchCore/src/de
- Timestamp:
- 04/14/11 13:51:20 (14 years ago)
- Location:
- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/FirstOrderMarkovModel.java
r19 r25 13 13 import Jama.Matrix; 14 14 15 public class FirstOrderMarkovModel extends HighOrderMarkovModel implements DotPrinter{15 public class FirstOrderMarkovModel extends HighOrderMarkovModel implements IDotCompatible { 16 16 17 17 final static int MAX_STATDIST_ITERATIONS = 1000; … … 39 39 } 40 40 41 public void printDot() { 42 Console.println("digraph model {"); 41 public String getDotRepresentation() { 42 StringBuilder stringBuilder = new StringBuilder(); 43 stringBuilder.append("digraph model {"); 43 44 44 45 List<Event<?>> knownSymbols = new ArrayList<Event<?>>(trie.getKnownSymbols()); … … 46 47 for( Event<?> symbol : knownSymbols) { 47 48 final String thisSaneId = symbol.getShortId().replace("\"", "\\\"").replaceAll("[\r\n]",""); 48 Console.println(" " + symbol.hashCode() + " [label=\""+thisSaneId+"\"];");49 stringBuilder.append(" " + symbol.hashCode() + " [label=\""+thisSaneId+"\"];"); 49 50 List<Event<?>> context = new ArrayList<Event<?>>(); 50 51 context.add(symbol); … … 55 56 } 56 57 } 57 System.out.println('}'); 58 stringBuilder.append('}'); 59 return stringBuilder.toString(); 58 60 } 59 61 -
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/IDotCompatible.java
r19 r25 1 1 package de.ugoe.cs.eventbench.models; 2 2 3 public interface DotPrinter{4 public abstract void printDot();3 public interface IDotCompatible { 4 public abstract String getDotRepresentation(); 5 5 }
Note: See TracChangeset
for help on using the changeset viewer.