Changeset 2030 for trunk/autoquest-core-tasktrees
- Timestamp:
- 07/30/15 14:23:54 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/TaskTreeUtils.java
r1767 r2030 14 14 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 17 import java.util.Collection; 18 import java.util.HashMap; 19 import java.util.HashSet; 20 import java.util.LinkedList; 21 import java.util.List; 22 import java.util.Map; 23 import java.util.Set; 16 24 17 25 /** … … 45 53 } 46 54 55 /** 56 * 57 */ 58 public static Set<ISequence> getMostProminentTasks(ITaskModel model, 59 Collection<ITask> tasks) 60 { 61 List<ISequence> sequences = new LinkedList<>(); 62 63 for (ITask task : tasks) { 64 if (task instanceof ISequence) { 65 sequences.add((ISequence) task); 66 } 67 } 68 69 return getMostProminentSequences(model, sequences); 70 } 71 72 /** 73 * 74 */ 75 public static Set<ISequence> getMostProminentSequences(ITaskModel model, 76 Collection<ISequence> tasks) 77 { 78 Map<Integer, List<ISequence>> sortedSequences = new HashMap<>(); 79 80 int maxCoverage = 0; 81 82 for (ITask task : tasks) { 83 int coveredEvents = 84 model.getTaskInfo((ISequence) task).getMeasureValue(TaskMetric.EVENT_COVERAGE); 85 86 List<ISequence> sequencesWithSameCoverage = sortedSequences.get(coveredEvents); 87 88 if (sequencesWithSameCoverage == null) { 89 sequencesWithSameCoverage = new LinkedList<>(); 90 sortedSequences.put(coveredEvents, sequencesWithSameCoverage); 91 } 92 93 sequencesWithSameCoverage.add((ISequence) task); 94 95 maxCoverage = Math.max(maxCoverage, coveredEvents); 96 } 97 98 Set<ISequence> result = new HashSet<>(); 99 100 for (int i = maxCoverage; i > 0; i--) { 101 List<ISequence> sequencesWithSameCoverage = sortedSequences.get(i); 102 103 if (sequencesWithSameCoverage != null) { 104 result.addAll(sequencesWithSameCoverage); 105 106 if (result.size() * 5 >= tasks.size()) { 107 break; 108 } 109 } 110 } 111 112 return result; 113 } 47 114 48 115 /**
Note: See TracChangeset
for help on using the changeset viewer.