Changeset 1322 for trunk/autoquest-plugin-alignment/src
- Timestamp:
- 12/16/13 20:46:44 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/seqgen/SimpleSequenceGenerator.java
r1314 r1322 1 1 package de.ugoe.cs.autoquest.plugin.alignment.seqgen; 2 import de.ugoe.cs.autoquest.eventcore.Event; 2 3 4 import java.util.ArrayList; 5 import java.util.Collection; 3 6 import java.util.List; 4 7 5 public class SimpleSequenceGenerator implements SequenceGenerator { 8 import de.ugoe.cs.autoquest.eventcore.Event; 9 import de.ugoe.cs.autoquest.tasktrees.manager.TaskTreeManager; 10 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 11 import de.ugoe.cs.autoquest.tasktrees.temporalrelation.TaskHandlingStrategy; 12 import de.ugoe.cs.autoquest.tasktrees.temporalrelation.TaskInstanceComparator; 13 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 14 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 15 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 16 import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 17 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 18 import de.ugoe.cs.autoquest.usageprofiles.SymbolMap; 19 20 21 public class SimpleSequenceGenerator implements ISequenceGenerator { 22 23 private ArrayList<int[]> numberseqs; 24 25 26 public SimpleSequenceGenerator() { 27 this.numberseqs = new ArrayList<int[]>(); 28 29 } 30 31 32 public void generate(Collection<List<Event>> sequences) { 6 33 7 34 8 public int[] generate(List<Event> eventList) { 9 int[] result = new int[10]; 10 for (int i=0; i<10;i++) { 11 result[i]=i+100; 35 if (sequences != null) { 36 TaskTreeManager ttm = new TaskTreeManager(); 37 ttm.createTaskModel(sequences); 38 39 TaskHandlingStrategy preparationTaskHandlingStrategy = new TaskHandlingStrategy(TaskEquality.SEMANTICALLY_EQUAL); 40 SymbolMap<ITaskInstance, ITask> uniqueTasks = preparationTaskHandlingStrategy 41 .createSymbolMap(); 42 TaskInstanceComparator comparator = preparationTaskHandlingStrategy 43 .getTaskComparator(); 44 int unifiedTasks = 0; 45 ITask task; 46 ITaskBuilder taskBuilder = new TaskBuilder(); 47 48 List<IUserSession> sessions = ttm.getTaskModel().getUserSessions(); 49 for (IUserSession session : sessions) { 50 //Creating a new sequence that just consists of integers 51 int[] templist = new int[session.size()]; 52 for (int i = 0; i < session.size(); i++) { 53 ITaskInstance taskInstance = session.get(i); 54 task = uniqueTasks.getValue(taskInstance); 55 56 if (task == null) { 57 uniqueTasks.addSymbol(taskInstance, 58 taskInstance.getTask()); 59 } else { 60 taskBuilder.setTask(taskInstance, task); 61 unifiedTasks++; 62 } 63 templist[i]=task.getId(); 64 } 65 66 comparator.clearBuffers(); 67 numberseqs.add(templist); 68 } 69 12 70 } 13 return result; 71 14 72 } 73 74 75 @Override 76 public int[] get(int index) { 77 return numberseqs.get(index); 78 } 79 15 80 } 81
Note: See TracChangeset
for help on using the changeset viewer.