Changeset 556
- Timestamp:
- 08/16/12 17:27:26 (12 years ago)
- 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 8 8 9 9 import de.ugoe.cs.quest.eventcore.Event; 10 import de.ugoe.cs.quest.plugin.guitar.eventcore.EFGEvent; 10 import de.ugoe.cs.quest.plugin.guitar.eventcore.GUITAREventTarget; 11 import de.ugoe.cs.quest.plugin.guitar.eventcore.GUITAREventType; 12 import de.ugoe.cs.quest.plugin.guitar.eventcore.GUITARReplayable; 11 13 import de.ugoe.cs.quest.ui.commands.CMDupdateModel; 12 14 import de.ugoe.cs.quest.usageprofiles.DeterministicFiniteAutomaton; … … 44 46 EFG efg = (EFG) IO.readObjFromFile(efgFileName, EFG.class); 45 47 46 Collection<List< ? extends Event<?>>> subsequences = generateEdgeSequences(efg);48 Collection<List<Event>> subsequences = generateEdgeSequences(efg); 47 49 FirstOrderMarkovModel model = new FirstOrderMarkovModel(new Random()); 48 50 model.train(subsequences); … … 63 65 EFG efg = (EFG) IO.readObjFromFile(efgFileName, EFG.class); 64 66 65 Collection<List< ? extends Event<?>>> subsequences = generateEdgeSequences(efg);67 Collection<List<Event>> subsequences = generateEdgeSequences(efg); 66 68 DeterministicFiniteAutomaton model = new DeterministicFiniteAutomaton( 67 69 new Random()); … … 81 83 * @return edge sequence set 82 84 */ 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); 85 87 /* 86 88 * getEventGraph returns an adjacency matrix, i.e., a square matrix of … … 89 91 */ 90 92 EventGraphType efgGraph = efg.getEventGraph(); 91 Collection<List< ? extends Event<?>>> subsequences = new LinkedList<List<? extends Event<?>>>();93 Collection<List<Event>> subsequences = new LinkedList<List<Event>>(); 92 94 93 95 int efgSize = events.size(); … … 97 99 // otherEvent is followed by currentEvent 98 100 if (relation != GUITARConstants.NO_EDGE) { 99 List<Event <?>> edge = new LinkedList<Event<?>>();101 List<Event> edge = new LinkedList<Event>(); 100 102 edge.add(events.get(row)); 101 103 edge.add(events.get(col)); … … 116 118 * @return list of events 117 119 */ 118 private List<Event <?>> createEvents(EFG efg) {120 private List<Event> createEvents(EFG efg) { 119 121 List<EventType> efgEvents = efg.getEvents().getEvent(); 120 List<Event <?>> myEvents = new ArrayList<Event<?>>(efgEvents.size());122 List<Event> myEvents = new ArrayList<Event>(efgEvents.size()); 121 123 for (EventType event : efgEvents) { 122 124 /* … … 124 126 * "interpretation" is found in the GUI file. 125 127 */ 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())); 129 132 } 130 133 return myEvents; -
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/plugin/guitar/GUITARTestCaseParser.java
r488 r556 6 6 7 7 import de.ugoe.cs.quest.eventcore.Event; 8 import de.ugoe.cs.quest.plugin.guitar.eventcore.EFGEvent; 8 import de.ugoe.cs.quest.plugin.guitar.eventcore.GUITAREventTarget; 9 import de.ugoe.cs.quest.plugin.guitar.eventcore.GUITAREventType; 10 import de.ugoe.cs.quest.plugin.guitar.eventcore.GUITARReplayable; 9 11 import edu.umd.cs.guitar.model.IO; 10 12 import edu.umd.cs.guitar.model.data.EFG; … … 70 72 * @return event sequence describing the test case 71 73 */ 72 public List<Event <?>> parseTestCaseFile(File testcaseFile) {74 public List<Event> parseTestCaseFile(File testcaseFile) { 73 75 TestCase testcase = (TestCase) IO.readObjFromFile( 74 76 testcaseFile.getAbsolutePath(), TestCase.class); 75 77 List<StepType> steps = testcase.getStep(); 76 List<Event <?>> sequence = new LinkedList<Event<?>>();78 List<Event> sequence = new LinkedList<Event>(); 77 79 for (StepType step : steps) { 78 80 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)); 81 85 sequence.add(event); 82 86 } -
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/plugin/guitar/commands/CMDefgTestCasesToSequences.java
r434 r556 53 53 } 54 54 }); 55 Collection<List<Event <?>>> sequences = new LinkedList<List<Event<?>>>();55 Collection<List<Event>> sequences = new LinkedList<List<Event>>(); 56 56 GUITARTestCaseParser parser; 57 57 if (efgFileName == null) { -
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/plugin/guitar/eventcore/GUITARReplayable.java
r549 r556 12 12 * @version 1.0 13 13 */ 14 public class EFGReplayable implements IReplayable {14 public class GUITARReplayable implements IReplayable { 15 15 16 16 /** … … 30 30 /** 31 31 * <p> 32 * Constructor. Creates a new {@link EFGReplayable}.32 * Constructor. Creates a new {@link GUITARReplayable}. 33 33 * </p> 34 34 * 35 35 * @param eventId 36 36 */ 37 public EFGReplayable(String eventId) {37 public GUITARReplayable(String eventId) { 38 38 this.eventId = eventId; 39 39 } … … 54 54 } 55 55 56 /*57 * (non-Javadoc)58 *59 * @see de.ugoe.cs.quest.eventcore.IReplayable#getTarget()60 */61 @Override62 public String getTarget() {63 return null; // target indirectly included in replay through the eventId64 }65 66 56 }
Note: See TracChangeset
for help on using the changeset viewer.