Changeset 547 for trunk/quest-ui-core/src/main
- Timestamp:
- 08/16/12 12:34:24 (12 years ago)
- Location:
- trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ReplayGenerator.java
r488 r547 9 9 10 10 import de.ugoe.cs.quest.IReplayDecorator; 11 import de.ugoe.cs.quest.eventcore.Event; 11 12 import de.ugoe.cs.quest.eventcore.IReplayable; 12 import de.ugoe.cs.quest.eventcore.ReplayableEvent;13 13 import de.ugoe.cs.util.StringTools; 14 14 import de.ugoe.cs.util.console.Console; … … 19 19 * if {@link ReplayableEvent}s. 20 20 * </p> 21 * 22 * TODO: Figure our how to handle {@link IReplayDecorator} 23 * TODO: Add appropriate checks if Events are replayable 21 24 * 22 25 * @author Steffen Herbold … … 52 55 */ 53 56 public void createLogfileMultipleSessions( 54 Collection<List< ReplayableEvent<?>>> sequences, String filename) {57 Collection<List<Event>> sequences, String filename) { 55 58 OutputStreamWriter writer = openReplayFile(filename); 56 59 if (writer != null) { … … 60 63 writer.write(decorator.getHeader()); 61 64 } 62 for (List< ReplayableEvent<?>> actions : sequences) {65 for (List<Event> actions : sequences) { 63 66 writeSession(actions, writer); 64 67 } … … 84 87 * name and path of the replay file 85 88 */ 86 public void createLogfileSingleSession(List< ReplayableEvent<?>> actions,89 public void createLogfileSingleSession(List<Event> actions, 87 90 String filename) { 88 91 OutputStreamWriter writer = openReplayFile(filename); … … 152 155 * thrown if there is a problem writing to writer 153 156 */ 154 private void writeSession(List< ReplayableEvent<?>> actions,157 private void writeSession(List<Event> actions, 155 158 OutputStreamWriter writer) throws IOException { 156 159 if (decorator != null) { 157 160 writer.write(decorator.getSessionHeader(sessionId)); 158 161 } 159 for ( ReplayableEvent<?>currentAction : actions) {162 for (Event currentAction : actions) { 160 163 161 164 List<? extends IReplayable> replayables = currentAction -
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/AbstractTrainCommand.java
r434 r547 81 81 return; 82 82 } 83 Collection<List< ? extends Event<?>>> sequences = (Collection<List<? extends Event<?>>>) dataObject;83 Collection<List<Event>> sequences = (Collection<List<Event>>) dataObject; 84 84 85 85 TrieBasedModel model = createModel(); -
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDcalcCoverage.java
r434 r547 49 49 50 50 IStochasticProcess process = null; 51 Collection<List< ? extends Event<?>>> observedSequences = null;52 Collection<List< ? extends Event<?>>> sequences = null;51 Collection<List<Event>> observedSequences = null; 52 Collection<List<Event>> sequences = null; 53 53 Object dataObjectProcess = GlobalDataContainer.getInstance().getData( 54 54 modelname); … … 73 73 } 74 74 process = (IStochasticProcess) dataObjectProcess; 75 observedSequences = (Collection<List< ? extends Event<?>>>) dataObjectObserved;75 observedSequences = (Collection<List<Event>>) dataObjectObserved; 76 76 77 77 Console.print("seqName"); … … 103 103 return; 104 104 } 105 sequences = (Collection<List< ? extends Event<?>>>) dataObjectSequences;105 sequences = (Collection<List<Event>>) dataObjectSequences; 106 106 Console.print(sequenceName); 107 107 for (int length = minLength; length <= maxLength; length++) { -
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDgenerateFixedLengthSequences.java
r524 r547 68 68 DrawFromAllSequencesGenerator generator = new DrawFromAllSequencesGenerator( 69 69 numSequences, minLength, maxLength, validEnd, all); 70 Collection<List< ? extends Event<?>>> sequences = generator70 Collection<List<Event>> sequences = generator 71 71 .generateTestSuite(model); 72 72 -
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDgenerateGreedy.java
r434 r547 78 78 79 79 // set up everything 80 List<List< ? extends Event<?>>> allSequences = new LinkedList<List<? extends Event<?>>>();80 List<List<Event>> allSequences = new LinkedList<List<Event>>(); 81 81 for (int length = minLength; length <= maxLength; length++) { 82 82 if (validEnd) { … … 88 88 Console.traceln("" + allSequences.size() + " possible"); 89 89 90 Collection<List< ? extends Event<?>>> allSubSeqs = model90 Collection<List<Event>> allSubSeqs = model 91 91 .generateSequences(coverageDepth); 92 Map<List< ? extends Event<?>>, Double> weightMap = SequenceTools92 Map<List<Event>, Double> weightMap = SequenceTools 93 93 .generateWeights(model, allSubSeqs); 94 Set<List< ? extends Event<?>>> coveredSubSeqs = new LinkedHashSet<List<? extends Event<?>>>();94 Set<List<Event>> coveredSubSeqs = new LinkedHashSet<List<Event>>(); 95 95 96 List<Set<List< ? extends Event<?>>>> containedSubSeqs = new LinkedList<Set<List<? extends Event<?>>>>();97 for (List< ? extends Event<?>> sequence : allSequences) {98 List<List< ? extends Event<?>>> wrapper = new LinkedList<List<? extends Event<?>>>();96 List<Set<List<Event>>> containedSubSeqs = new LinkedList<Set<List<Event>>>(); 97 for (List<Event> sequence : allSequences) { 98 List<List<Event>> wrapper = new LinkedList<List<Event>>(); 99 99 wrapper.add(sequence); 100 Set<List< ? extends Event<?>>> currentSubSeqs = SequenceTools100 Set<List<Event>> currentSubSeqs = SequenceTools 101 101 .containedSubSequences(wrapper, coverageDepth); 102 102 containedSubSeqs.add(currentSubSeqs); 103 103 } 104 104 105 List<List< ? extends Event<?>>> testSuite = new LinkedList<List<? extends Event<?>>>();105 List<List<Event>> testSuite = new LinkedList<List<Event>>(); 106 106 double currentCoverage = 0.0d; 107 107 … … 112 112 Double[] sequenceGain = new Double[allSequences.size()]; 113 113 int i = 0; 114 for (Set<List< ? extends Event<?>>> containedSubSeq : containedSubSeqs) {114 for (Set<List<Event>> containedSubSeq : containedSubSeqs) { 115 115 double gain = 0.0d; 116 Iterator<List< ? extends Event<?>>> subSeqIter = containedSubSeq116 Iterator<List<Event>> subSeqIter = containedSubSeq 117 117 .iterator(); 118 118 while (subSeqIter.hasNext()) { 119 List< ? extends Event<?>> subSeq = subSeqIter.next();119 List<Event> subSeq = subSeqIter.next(); 120 120 if (!coveredSubSeqs.contains(subSeq)) { 121 121 gain += weightMap.get(subSeq); -
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDgenerateHybrid.java
r524 r547 78 78 79 79 HybridGenerator generator = new HybridGenerator(numSequences, length, maxLengthAll, validEnd); 80 Collection<List< ? extends Event<?>>> sequences = generator.generateTestSuite(model);80 Collection<List<Event>> sequences = generator.generateTestSuite(model); 81 81 82 82 if (GlobalDataContainer.getInstance().addData(sequencesName, sequences)) { -
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDgenerateRandomReplay.java
r434 r547 8 8 import de.ugoe.cs.quest.CommandHelpers; 9 9 import de.ugoe.cs.quest.ReplayGenerator; 10 import de.ugoe.cs.quest.eventcore. ReplayableEvent;10 import de.ugoe.cs.quest.eventcore.Event; 11 11 import de.ugoe.cs.quest.ui.GlobalDataContainer; 12 12 import de.ugoe.cs.quest.usageprofiles.IStochasticProcess; … … 67 67 } 68 68 model = (IStochasticProcess) dataObject; 69 Collection<List< ReplayableEvent<?>>> sequences = new LinkedList<List<ReplayableEvent<?>>>();69 Collection<List<Event>> sequences = new LinkedList<List<Event>>(); 70 70 try { 71 71 for (int i = 0; i < numSessions; i++) { 72 72 sequences 73 .add((List< ReplayableEvent<?>>) model.randomSequence());73 .add((List<Event>) model.randomSequence()); 74 74 } 75 75 } catch (ClassCastException e) { -
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDgenerateRandomSequences.java
r524 r547 69 69 RandomWalkGenerator generator = new RandomWalkGenerator(numSessions, 70 70 minLength, maxLength, validEnd, maxIter); 71 Collection<List< ? extends Event<?>>> sequences = generator71 Collection<List<Event>> sequences = generator 72 72 .generateTestSuite(model); 73 73 -
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDgenerateReplayfile.java
r434 r547 8 8 import de.ugoe.cs.quest.ReplayGenerator; 9 9 import de.ugoe.cs.quest.SequenceInstanceOf; 10 import de.ugoe.cs.quest.eventcore. ReplayableEvent;10 import de.ugoe.cs.quest.eventcore.Event; 11 11 import de.ugoe.cs.quest.ui.GlobalDataContainer; 12 12 import de.ugoe.cs.util.console.Command; … … 50 50 } 51 51 52 Collection<List< ReplayableEvent<?>>> sequences = null;52 Collection<List<Event>> sequences = null; 53 53 Object dataObject = GlobalDataContainer.getInstance().getData( 54 54 sequencesName); … … 63 63 } 64 64 65 sequences = (Collection<List< ReplayableEvent<?>>>) dataObject;65 sequences = (Collection<List<Event>>) dataObject; 66 66 ReplayGenerator generator = new ReplayGenerator(); 67 67 generator.createLogfileMultipleSessions(sequences, filename); -
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDsequenceStatistics.java
r434 r547 41 41 } 42 42 43 Collection<List<Event <?>>> sequences = null;43 Collection<List<Event>> sequences = null; 44 44 Object dataObject = GlobalDataContainer.getInstance().getData( 45 45 sequencesName); … … 54 54 } 55 55 56 sequences = (Collection<List<Event <?>>>) dataObject;56 sequences = (Collection<List<Event>>) dataObject; 57 57 Console.println("Number of Sequences: " + sequences.size()); 58 58 SortedMap<Integer, Integer> lengthMap = new TreeMap<Integer, Integer>(); 59 for (List<Event <?>> sequence : sequences) {59 for (List<Event> sequence : sequences) { 60 60 Integer currentSize = sequence.size(); 61 61 if (lengthMap.containsKey(currentSize)) { -
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDupdateModel.java
r434 r547 52 52 return; 53 53 } 54 Collection<List< ? extends Event<?>>> sequences = (Collection<List<? extends Event<?>>>) dataObject;54 Collection<List<Event>> sequences = (Collection<List<Event>>) dataObject; 55 55 56 56 dataObject = GlobalDataContainer.getInstance().getData(modelname);
Note: See TracChangeset
for help on using the changeset viewer.