Changeset 547 for trunk/quest-ui-core


Ignore:
Timestamp:
08/16/12 12:34:24 (12 years ago)
Author:
sherbold
Message:
  • countless adaptations throughout nearly all components to remove errors introduced due to the refactoring of the event core
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  
    99 
    1010import de.ugoe.cs.quest.IReplayDecorator; 
     11import de.ugoe.cs.quest.eventcore.Event; 
    1112import de.ugoe.cs.quest.eventcore.IReplayable; 
    12 import de.ugoe.cs.quest.eventcore.ReplayableEvent; 
    1313import de.ugoe.cs.util.StringTools; 
    1414import de.ugoe.cs.util.console.Console; 
     
    1919 * if {@link ReplayableEvent}s. 
    2020 * </p> 
     21 *  
     22 * TODO: Figure our how to handle {@link IReplayDecorator} 
     23 * TODO: Add appropriate checks if Events are replayable 
    2124 *  
    2225 * @author Steffen Herbold 
     
    5255         */ 
    5356        public void createLogfileMultipleSessions( 
    54                         Collection<List<ReplayableEvent<?>>> sequences, String filename) { 
     57                        Collection<List<Event>> sequences, String filename) { 
    5558                OutputStreamWriter writer = openReplayFile(filename); 
    5659                if (writer != null) { 
     
    6063                                        writer.write(decorator.getHeader()); 
    6164                                } 
    62                                 for (List<ReplayableEvent<?>> actions : sequences) { 
     65                                for (List<Event> actions : sequences) { 
    6366                                        writeSession(actions, writer); 
    6467                                } 
     
    8487         *            name and path of the replay file 
    8588         */ 
    86         public void createLogfileSingleSession(List<ReplayableEvent<?>> actions, 
     89        public void createLogfileSingleSession(List<Event> actions, 
    8790                        String filename) { 
    8891                OutputStreamWriter writer = openReplayFile(filename); 
     
    152155         *             thrown if there is a problem writing to writer 
    153156         */ 
    154         private void writeSession(List<ReplayableEvent<?>> actions, 
     157        private void writeSession(List<Event> actions, 
    155158                        OutputStreamWriter writer) throws IOException { 
    156159                if (decorator != null) { 
    157160                        writer.write(decorator.getSessionHeader(sessionId)); 
    158161                } 
    159                 for (ReplayableEvent<?> currentAction : actions) { 
     162                for (Event currentAction : actions) { 
    160163 
    161164                        List<? extends IReplayable> replayables = currentAction 
  • trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/AbstractTrainCommand.java

    r434 r547  
    8181                        return; 
    8282                } 
    83                 Collection<List<? extends Event<?>>> sequences = (Collection<List<? extends Event<?>>>) dataObject; 
     83                Collection<List<Event>> sequences = (Collection<List<Event>>) dataObject; 
    8484 
    8585                TrieBasedModel model = createModel(); 
  • trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDcalcCoverage.java

    r434 r547  
    4949 
    5050                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; 
    5353                Object dataObjectProcess = GlobalDataContainer.getInstance().getData( 
    5454                                modelname); 
     
    7373                } 
    7474                process = (IStochasticProcess) dataObjectProcess; 
    75                 observedSequences = (Collection<List<? extends Event<?>>>) dataObjectObserved; 
     75                observedSequences = (Collection<List<Event>>) dataObjectObserved; 
    7676 
    7777                Console.print("seqName"); 
     
    103103                                return; 
    104104                        } 
    105                         sequences = (Collection<List<? extends Event<?>>>) dataObjectSequences; 
     105                        sequences = (Collection<List<Event>>) dataObjectSequences; 
    106106                        Console.print(sequenceName); 
    107107                        for (int length = minLength; length <= maxLength; length++) { 
  • trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDgenerateFixedLengthSequences.java

    r524 r547  
    6868                DrawFromAllSequencesGenerator generator = new DrawFromAllSequencesGenerator( 
    6969                                numSequences, minLength, maxLength, validEnd, all); 
    70                 Collection<List<? extends Event<?>>> sequences = generator 
     70                Collection<List<Event>> sequences = generator 
    7171                                .generateTestSuite(model); 
    7272 
  • trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDgenerateGreedy.java

    r434 r547  
    7878 
    7979                // set up everything 
    80                 List<List<? extends Event<?>>> allSequences = new LinkedList<List<? extends Event<?>>>(); 
     80                List<List<Event>> allSequences = new LinkedList<List<Event>>(); 
    8181                for (int length = minLength; length <= maxLength; length++) { 
    8282                        if (validEnd) { 
     
    8888                Console.traceln("" + allSequences.size() + " possible"); 
    8989 
    90                 Collection<List<? extends Event<?>>> allSubSeqs = model 
     90                Collection<List<Event>> allSubSeqs = model 
    9191                                .generateSequences(coverageDepth); 
    92                 Map<List<? extends Event<?>>, Double> weightMap = SequenceTools 
     92                Map<List<Event>, Double> weightMap = SequenceTools 
    9393                                .generateWeights(model, allSubSeqs); 
    94                 Set<List<? extends Event<?>>> coveredSubSeqs = new LinkedHashSet<List<? extends Event<?>>>(); 
     94                Set<List<Event>> coveredSubSeqs = new LinkedHashSet<List<Event>>(); 
    9595 
    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>>(); 
    9999                        wrapper.add(sequence); 
    100                         Set<List<? extends Event<?>>> currentSubSeqs = SequenceTools 
     100                        Set<List<Event>> currentSubSeqs = SequenceTools 
    101101                                        .containedSubSequences(wrapper, coverageDepth); 
    102102                        containedSubSeqs.add(currentSubSeqs); 
    103103                } 
    104104 
    105                 List<List<? extends Event<?>>> testSuite = new LinkedList<List<? extends Event<?>>>(); 
     105                List<List<Event>> testSuite = new LinkedList<List<Event>>(); 
    106106                double currentCoverage = 0.0d; 
    107107 
     
    112112                        Double[] sequenceGain = new Double[allSequences.size()]; 
    113113                        int i = 0; 
    114                         for (Set<List<? extends Event<?>>> containedSubSeq : containedSubSeqs) { 
     114                        for (Set<List<Event>> containedSubSeq : containedSubSeqs) { 
    115115                                double gain = 0.0d; 
    116                                 Iterator<List<? extends Event<?>>> subSeqIter = containedSubSeq 
     116                                Iterator<List<Event>> subSeqIter = containedSubSeq 
    117117                                                .iterator(); 
    118118                                while (subSeqIter.hasNext()) { 
    119                                         List<? extends Event<?>> subSeq = subSeqIter.next(); 
     119                                        List<Event> subSeq = subSeqIter.next(); 
    120120                                        if (!coveredSubSeqs.contains(subSeq)) { 
    121121                                                gain += weightMap.get(subSeq); 
  • trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDgenerateHybrid.java

    r524 r547  
    7878                 
    7979                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); 
    8181                 
    8282                if (GlobalDataContainer.getInstance().addData(sequencesName, sequences)) { 
  • trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDgenerateRandomReplay.java

    r434 r547  
    88import de.ugoe.cs.quest.CommandHelpers; 
    99import de.ugoe.cs.quest.ReplayGenerator; 
    10 import de.ugoe.cs.quest.eventcore.ReplayableEvent; 
     10import de.ugoe.cs.quest.eventcore.Event; 
    1111import de.ugoe.cs.quest.ui.GlobalDataContainer; 
    1212import de.ugoe.cs.quest.usageprofiles.IStochasticProcess; 
     
    6767                } 
    6868                model = (IStochasticProcess) dataObject; 
    69                 Collection<List<ReplayableEvent<?>>> sequences = new LinkedList<List<ReplayableEvent<?>>>(); 
     69                Collection<List<Event>> sequences = new LinkedList<List<Event>>(); 
    7070                try { 
    7171                        for (int i = 0; i < numSessions; i++) { 
    7272                                sequences 
    73                                                 .add((List<ReplayableEvent<?>>) model.randomSequence()); 
     73                                                .add((List<Event>) model.randomSequence()); 
    7474                        } 
    7575                } catch (ClassCastException e) { 
  • trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDgenerateRandomSequences.java

    r524 r547  
    6969                RandomWalkGenerator generator = new RandomWalkGenerator(numSessions, 
    7070                                minLength, maxLength, validEnd, maxIter); 
    71                 Collection<List<? extends Event<?>>> sequences = generator 
     71                Collection<List<Event>> sequences = generator 
    7272                                .generateTestSuite(model); 
    7373 
  • trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDgenerateReplayfile.java

    r434 r547  
    88import de.ugoe.cs.quest.ReplayGenerator; 
    99import de.ugoe.cs.quest.SequenceInstanceOf; 
    10 import de.ugoe.cs.quest.eventcore.ReplayableEvent; 
     10import de.ugoe.cs.quest.eventcore.Event; 
    1111import de.ugoe.cs.quest.ui.GlobalDataContainer; 
    1212import de.ugoe.cs.util.console.Command; 
     
    5050                } 
    5151 
    52                 Collection<List<ReplayableEvent<?>>> sequences = null; 
     52                Collection<List<Event>> sequences = null; 
    5353                Object dataObject = GlobalDataContainer.getInstance().getData( 
    5454                                sequencesName); 
     
    6363                } 
    6464 
    65                 sequences = (Collection<List<ReplayableEvent<?>>>) dataObject; 
     65                sequences = (Collection<List<Event>>) dataObject; 
    6666                ReplayGenerator generator = new ReplayGenerator(); 
    6767                generator.createLogfileMultipleSessions(sequences, filename); 
  • trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDsequenceStatistics.java

    r434 r547  
    4141                } 
    4242 
    43                 Collection<List<Event<?>>> sequences = null; 
     43                Collection<List<Event>> sequences = null; 
    4444                Object dataObject = GlobalDataContainer.getInstance().getData( 
    4545                                sequencesName); 
     
    5454                } 
    5555 
    56                 sequences = (Collection<List<Event<?>>>) dataObject; 
     56                sequences = (Collection<List<Event>>) dataObject; 
    5757                Console.println("Number of Sequences: " + sequences.size()); 
    5858                SortedMap<Integer, Integer> lengthMap = new TreeMap<Integer, Integer>(); 
    59                 for (List<Event<?>> sequence : sequences) { 
     59                for (List<Event> sequence : sequences) { 
    6060                        Integer currentSize = sequence.size(); 
    6161                        if (lengthMap.containsKey(currentSize)) { 
  • trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDupdateModel.java

    r434 r547  
    5252                        return; 
    5353                } 
    54                 Collection<List<? extends Event<?>>> sequences = (Collection<List<? extends Event<?>>>) dataObject; 
     54                Collection<List<Event>> sequences = (Collection<List<Event>>) dataObject; 
    5555 
    5656                dataObject = GlobalDataContainer.getInstance().getData(modelname); 
Note: See TracChangeset for help on using the changeset viewer.