Changeset 1733 for branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskHandlingStrategy.java
- Timestamp:
- 09/05/14 19:33:12 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskHandlingStrategy.java
r1551 r1733 24 24 * <p> 25 25 * concrete implementation of a symbol strategy required in the creation of a 26 * {@link de.ugoe.cs.autoquest.usageprofiles.Trie}. The strategy can be parameterized with a 27 * considered task equality. It uses task instance comparators to perform task comparison. 28 * It creates task specific symbol maps, which are {@link TaskSymbolIdentityMap} and 29 * {@link TaskSymbolBucketedMap} depending on the level of considered task equality. 26 * {@link de.ugoe.cs.autoquest.usageprofiles.Trie}. The strategy can be 27 * parameterized with a considered task equality. It uses task instance 28 * comparators to perform task comparison. It creates task specific symbol maps, 29 * which are {@link TaskSymbolIdentityMap} and {@link TaskSymbolBucketedMap} 30 * depending on the level of considered task equality. 30 31 * </p> 31 32 * … … 33 34 */ 34 35 public class TaskHandlingStrategy implements SymbolStrategy<ITaskInstance> { 35 36 /** */37 private static final long serialVersionUID = 1L;38 36 39 /** 40 * <p> 41 * the level of task equality considered in this task handling strategy 42 * </p> 43 */ 44 private TaskEquality consideredEquality; 37 /** */ 38 private static final long serialVersionUID = 1L; 45 39 46 47 48 * the comparator used for task comparisons 49 50 51 private TaskInstanceComparator comparator;40 /** 41 * <p> 42 * the level of task equality considered in this task handling strategy 43 * </p> 44 */ 45 private final TaskEquality consideredEquality; 52 46 53 /** 54 * <p> 55 * initializes this strategy with a task equality to be considered for task comparisons 56 * g</p> 57 * 58 * @param consideredEquality the task equality to be considered for task comparisons 59 */ 60 public TaskHandlingStrategy(TaskEquality consideredEquality) { 61 this.consideredEquality = consideredEquality; 62 63 if (this.consideredEquality == TaskEquality.IDENTICAL) { 64 comparator = new TaskIdentityComparator(); 65 } 66 else { 67 comparator = new TaskInstanceComparator(this.consideredEquality); 68 } 69 } 47 /** 48 * <p> 49 * the comparator used for task comparisons 50 * </p> 51 */ 52 private TaskInstanceComparator comparator; 70 53 71 /* (non-Javadoc) 72 * @see de.ugoe.cs.autoquest.usageprofiles.SymbolStrategy#getSymbolComparator() 73 */ 74 @Override 75 public SymbolComparator<ITaskInstance> getSymbolComparator() { 76 return comparator; 77 } 54 /** 55 * <p> 56 * initializes this strategy with a task equality to be considered for task 57 * comparisons g 58 * </p> 59 * 60 * @param consideredEquality 61 * the task equality to be considered for task comparisons 62 */ 63 public TaskHandlingStrategy(TaskEquality consideredEquality) { 64 this.consideredEquality = consideredEquality; 78 65 79 /** 80 * <p> 81 * convenience method to have a correctly typed return value as alternative to 82 * {@link #getSymbolComparator()}; 83 * </p> 84 */ 85 public TaskInstanceComparator getTaskComparator() { 86 return comparator; 87 } 66 if (this.consideredEquality == TaskEquality.IDENTICAL) { 67 comparator = new TaskIdentityComparator(); 68 } else { 69 comparator = new TaskInstanceComparator(this.consideredEquality); 70 } 71 } 88 72 89 /* (non-Javadoc) 90 * @see de.ugoe.cs.autoquest.usageprofiles.SymbolStrategy#createSymbolMap() 91 */ 92 @Override 93 public <V> SymbolMap<ITaskInstance, V> createSymbolMap() { 94 if (consideredEquality == TaskEquality.IDENTICAL) { 95 return new TaskSymbolIdentityMap<V>(); 96 } 97 else { 98 return new TaskSymbolBucketedMap<V>(comparator); 99 } 100 } 73 /* 74 * (non-Javadoc) 75 * 76 * @see 77 * de.ugoe.cs.autoquest.usageprofiles.SymbolStrategy#copySymbolMap(SymbolMap 78 * ) 79 */ 80 @Override 81 public <V> SymbolMap<ITaskInstance, V> copySymbolMap( 82 SymbolMap<ITaskInstance, V> other) { 83 if (consideredEquality == TaskEquality.IDENTICAL) { 84 return new TaskSymbolIdentityMap<V>(other); 85 } else { 86 return new TaskSymbolBucketedMap<V>(comparator); 87 } 88 } 101 89 102 /* (non-Javadoc) 103 * @see de.ugoe.cs.autoquest.usageprofiles.SymbolStrategy#copySymbolMap(SymbolMap) 104 */ 105 @Override 106 public <V> SymbolMap<ITaskInstance, V> copySymbolMap(SymbolMap<ITaskInstance, V> other) { 107 if (consideredEquality == TaskEquality.IDENTICAL) { 108 return new TaskSymbolIdentityMap<V>(other); 109 } 110 else { 111 return new TaskSymbolBucketedMap<V>(comparator); 112 } 113 } 90 /* 91 * (non-Javadoc) 92 * 93 * @see de.ugoe.cs.autoquest.usageprofiles.SymbolStrategy#createSymbolMap() 94 */ 95 @Override 96 public <V> SymbolMap<ITaskInstance, V> createSymbolMap() { 97 if (consideredEquality == TaskEquality.IDENTICAL) { 98 return new TaskSymbolIdentityMap<V>(); 99 } else { 100 return new TaskSymbolBucketedMap<V>(comparator); 101 } 102 } 103 104 /* 105 * (non-Javadoc) 106 * 107 * @see 108 * de.ugoe.cs.autoquest.usageprofiles.SymbolStrategy#getSymbolComparator() 109 */ 110 @Override 111 public SymbolComparator<ITaskInstance> getSymbolComparator() { 112 return comparator; 113 } 114 115 /** 116 * <p> 117 * convenience method to have a correctly typed return value as alternative 118 * to {@link #getSymbolComparator()}; 119 * </p> 120 */ 121 public TaskInstanceComparator getTaskComparator() { 122 return comparator; 123 } 114 124 115 125 }
Note: See TracChangeset
for help on using the changeset viewer.