Changeset 1285 for trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskComparator.java
- Timestamp:
- 07/30/13 09:44:39 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskComparator.java
r1256 r1285 19 19 import java.util.HashMap; 20 20 21 import de.ugoe.cs.autoquest.eventcore.IEventType;22 21 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 23 22 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 24 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask;25 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration;26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection;27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence;28 23 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 29 24 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; … … 39 34 40 35 /** */ 41 private static final int MAX_BUFFER_SIZE = 10* 1024 * 1024;36 private static final int MAX_BUFFER_SIZE = 2 * 1024 * 1024; 42 37 43 38 /** */ … … 79 74 80 75 if (task1 != task2) { 81 if ((task1 instanceof IEventTask) && (task2 instanceof IEventTask)) {76 //if ((task1 instanceof IEventTask) && (task2 instanceof IEventTask)) { 82 77 long key = ((long) System.identityHashCode(task1)) << 32; 83 78 key += System.identityHashCode(task2); … … 92 87 } 93 88 } 94 }89 /*} 95 90 else { 96 91 result = false; 97 } 92 }*/ 98 93 } 99 94 else { … … 118 113 if (result == null) { 119 114 result = lexicalComparer.compare(task1, task2); 120 if (equalityBuffer.size() < 1024 * 1024 * 10) {115 if (equalityBuffer.size() < MAX_BUFFER_SIZE) { 121 116 lexicalEqualityBuffer.put(key, result); 122 117 } … … 130 125 } 131 126 132 /* (non-Javadoc) 133 * @see SymbolComparator#getBucketSearchOrder(Object) 134 */ 135 @Override 136 public int[] getBucketSearchOrder(ITaskInstance taskInstance) { 137 // 0 = sequence; 1 = selection; 2 = iteration; 3 = optional; 4 = event task in general; 138 // other = hashCode of name of event type 139 140 ITask task = taskInstance.getTask(); 141 142 if (task instanceof IEventTask) { 143 // event tasks are most likely equal to those of the event type with the same name, 144 // Afterwards, they may be equal to iterations, optionals, other event tasks, 145 // selections, and finally the rest. 146 IEventType eventType = ((IEventTask) task).getEventType(); 147 return new int[] { eventType.getName().hashCode(), 2, 3, 4, 1 }; 148 } 149 else if (task instanceof ISequence) { 150 return new int[] { 0, 2, 3, 1 }; 151 } 152 else if (task instanceof ISelection) { 153 return new int[] { 1, 4, 2, 3 }; 154 } 155 else if (task instanceof IIteration) { 156 return new int[] { 2, 1, 4 }; 157 } 158 159 return null; 160 } 161 127 /** 128 * <p> 129 * TODO: comment 130 * </p> 131 * 132 */ 133 void clearBuffers() { 134 equalityBuffer.clear(); 135 init(); 136 } 137 162 138 /** 163 139 * … … 275 251 } 276 252 } 253 277 254 }
Note: See TracChangeset
for help on using the changeset viewer.