Changeset 556


Ignore:
Timestamp:
08/16/12 17:27:26 (12 years ago)
Author:
sherbold
Message:
  • adapted GUITAR plugin to new event core
Location:
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/plugin/guitar
Files:
2 added
1 deleted
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/plugin/guitar/EFGModelGenerator.java

    r488 r556  
    88 
    99import de.ugoe.cs.quest.eventcore.Event; 
    10 import de.ugoe.cs.quest.plugin.guitar.eventcore.EFGEvent; 
     10import de.ugoe.cs.quest.plugin.guitar.eventcore.GUITAREventTarget; 
     11import de.ugoe.cs.quest.plugin.guitar.eventcore.GUITAREventType; 
     12import de.ugoe.cs.quest.plugin.guitar.eventcore.GUITARReplayable; 
    1113import de.ugoe.cs.quest.ui.commands.CMDupdateModel; 
    1214import de.ugoe.cs.quest.usageprofiles.DeterministicFiniteAutomaton; 
     
    4446                EFG efg = (EFG) IO.readObjFromFile(efgFileName, EFG.class); 
    4547 
    46                 Collection<List<? extends Event<?>>> subsequences = generateEdgeSequences(efg); 
     48                Collection<List<Event>> subsequences = generateEdgeSequences(efg); 
    4749                FirstOrderMarkovModel model = new FirstOrderMarkovModel(new Random()); 
    4850                model.train(subsequences); 
     
    6365                EFG efg = (EFG) IO.readObjFromFile(efgFileName, EFG.class); 
    6466 
    65                 Collection<List<? extends Event<?>>> subsequences = generateEdgeSequences(efg); 
     67                Collection<List<Event>> subsequences = generateEdgeSequences(efg); 
    6668                DeterministicFiniteAutomaton model = new DeterministicFiniteAutomaton( 
    6769                                new Random()); 
     
    8183         * @return edge sequence set 
    8284         */ 
    83         private Collection<List<? extends Event<?>>> generateEdgeSequences(EFG efg) { 
    84                 List<Event<?>> events = createEvents(efg); 
     85        private Collection<List<Event>> generateEdgeSequences(EFG efg) { 
     86                List<Event> events = createEvents(efg); 
    8587                /* 
    8688                 * getEventGraph returns an adjacency matrix, i.e., a square matrix of 
     
    8991                 */ 
    9092                EventGraphType efgGraph = efg.getEventGraph(); 
    91                 Collection<List<? extends Event<?>>> subsequences = new LinkedList<List<? extends Event<?>>>(); 
     93                Collection<List<Event>> subsequences = new LinkedList<List<Event>>(); 
    9294 
    9395                int efgSize = events.size(); 
     
    9799                                // otherEvent is followed by currentEvent 
    98100                                if (relation != GUITARConstants.NO_EDGE) { 
    99                                         List<Event<?>> edge = new LinkedList<Event<?>>(); 
     101                                        List<Event> edge = new LinkedList<Event>(); 
    100102                                        edge.add(events.get(row)); 
    101103                                        edge.add(events.get(col)); 
     
    116118         * @return list of events 
    117119         */ 
    118         private List<Event<?>> createEvents(EFG efg) { 
     120        private List<Event> createEvents(EFG efg) { 
    119121                List<EventType> efgEvents = efg.getEvents().getEvent(); 
    120                 List<Event<?>> myEvents = new ArrayList<Event<?>>(efgEvents.size()); 
     122                List<Event> myEvents = new ArrayList<Event>(efgEvents.size()); 
    121123                for (EventType event : efgEvents) { 
    122124                        /* 
     
    124126                         * "interpretation" is found in the GUI file. 
    125127                         */ 
    126                         Event<?> myEvent = new EFGEvent(event.getEventId()); 
    127                         myEvent.setTarget(event.getWidgetId()); 
    128                         myEvents.add(myEvent); 
     128                    GUITAREventType type = new GUITAREventType(event.getEventId()); 
     129                    GUITAREventTarget target = new GUITAREventTarget(event.getWidgetId()); 
     130                    Event myEvent = new Event(type, target); 
     131                    myEvent.addReplayable(new GUITARReplayable(event.getEventId())); 
    129132                } 
    130133                return myEvents; 
  • trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/plugin/guitar/GUITARTestCaseParser.java

    r488 r556  
    66 
    77import de.ugoe.cs.quest.eventcore.Event; 
    8 import de.ugoe.cs.quest.plugin.guitar.eventcore.EFGEvent; 
     8import de.ugoe.cs.quest.plugin.guitar.eventcore.GUITAREventTarget; 
     9import de.ugoe.cs.quest.plugin.guitar.eventcore.GUITAREventType; 
     10import de.ugoe.cs.quest.plugin.guitar.eventcore.GUITARReplayable; 
    911import edu.umd.cs.guitar.model.IO; 
    1012import edu.umd.cs.guitar.model.data.EFG; 
     
    7072         * @return event sequence describing the test case 
    7173         */ 
    72         public List<Event<?>> parseTestCaseFile(File testcaseFile) { 
     74        public List<Event> parseTestCaseFile(File testcaseFile) { 
    7375                TestCase testcase = (TestCase) IO.readObjFromFile( 
    7476                                testcaseFile.getAbsolutePath(), TestCase.class); 
    7577                List<StepType> steps = testcase.getStep(); 
    76                 List<Event<?>> sequence = new LinkedList<Event<?>>(); 
     78                List<Event> sequence = new LinkedList<Event>(); 
    7779                for (StepType step : steps) { 
    7880                        String eventId = step.getEventId(); 
    79                         EFGEvent event = new EFGEvent(eventId); 
    80                         event.setTarget(getWidgetId(eventId)); 
     81                        GUITAREventType type = new GUITAREventType(eventId); 
     82                        GUITAREventTarget target = new GUITAREventTarget(getWidgetId(eventId)); 
     83                        Event event = new Event(type, target); 
     84                        event.addReplayable(new GUITARReplayable(eventId)); 
    8185                        sequence.add(event); 
    8286                } 
  • trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/plugin/guitar/commands/CMDefgTestCasesToSequences.java

    r434 r556  
    5353                        } 
    5454                }); 
    55                 Collection<List<Event<?>>> sequences = new LinkedList<List<Event<?>>>(); 
     55                Collection<List<Event>> sequences = new LinkedList<List<Event>>(); 
    5656                GUITARTestCaseParser parser; 
    5757                if (efgFileName == null) { 
  • trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/plugin/guitar/eventcore/GUITARReplayable.java

    r549 r556  
    1212 * @version 1.0 
    1313 */ 
    14 public class EFGReplayable implements IReplayable { 
     14public class GUITARReplayable implements IReplayable { 
    1515 
    1616        /** 
     
    3030        /** 
    3131         * <p> 
    32          * Constructor. Creates a new {@link EFGReplayable}. 
     32         * Constructor. Creates a new {@link GUITARReplayable}. 
    3333         * </p> 
    3434         *  
    3535         * @param eventId 
    3636         */ 
    37         public EFGReplayable(String eventId) { 
     37        public GUITARReplayable(String eventId) { 
    3838                this.eventId = eventId; 
    3939        } 
     
    5454        } 
    5555 
    56         /* 
    57          * (non-Javadoc) 
    58          *  
    59          * @see de.ugoe.cs.quest.eventcore.IReplayable#getTarget() 
    60          */ 
    61         @Override 
    62         public String getTarget() { 
    63                 return null; // target indirectly included in replay through the eventId 
    64         } 
    65  
    6656} 
Note: See TracChangeset for help on using the changeset viewer.