Changeset 1846 for trunk/autoquest-core-tasktrees-test/src
- Timestamp:
- 12/23/14 10:55:46 (10 years ago)
- Location:
- trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskInstanceTrieTest.java
r1294 r1846 26 26 import de.ugoe.cs.autoquest.tasktrees.TaskTreeDecoder; 27 27 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 28 29 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 29 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance;31 31 import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 32 32 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; … … 114 114 fixture.trainSessions(Arrays.asList(session), 2); 115 115 116 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0) )));117 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1) )));118 assertEquals(1, fixture.getCount(Arrays.asList(session.get(2) )));116 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0).getTask()))); 117 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask()))); 118 assertEquals(1, fixture.getCount(Arrays.asList(session.get(2).getTask()))); 119 119 120 120 // subsequences of length 1 are not trained. So for the single item sequence of the last 121 121 // task, the count must be 0 122 assertEquals(0, fixture.getCount(Arrays.asList(session.get(3)))); 123 124 125 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0), session.get(1)))); 126 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1), session.get(2)))); 127 assertEquals(1, fixture.getCount(Arrays.asList(session.get(2), session.get(3)))); 122 assertEquals(0, fixture.getCount(Arrays.asList(session.get(3).getTask()))); 123 124 125 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0).getTask(), 126 session.get(1).getTask()))); 127 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask(), 128 session.get(2).getTask()))); 129 assertEquals(1, fixture.getCount(Arrays.asList(session.get(2).getTask(), 130 session.get(3).getTask()))); 128 131 129 132 // this must return 0 as we only trained shorter sequences 130 assertEquals(0, fixture.getCount(Arrays.asList(session.get(0), session.get(1), 131 session.get(2)))); 133 assertEquals(0, fixture.getCount(Arrays.asList(session.get(0).getTask(), 134 session.get(1).getTask(), 135 session.get(2).getTask()))); 132 136 133 137 // subsequences of length 1 are not trained. So the single item sequence of the last … … 153 157 // subsequences of length 1 are not trained. So the single item sequence of the last 154 158 // task is not counted. Therefore, the result must be 3 155 assertEquals(3, fixture.getCount(Arrays.asList(session.get(i) )));159 assertEquals(3, fixture.getCount(Arrays.asList(session.get(i).getTask()))); 156 160 157 161 for (int j = 0; j < session.size(); j++) { 158 assertEquals(3, fixture.getCount(Arrays.asList(session.get(i), session.get(j)))); 162 assertEquals(3, fixture.getCount(Arrays.asList(session.get(i).getTask(), 163 session.get(j).getTask()))); 159 164 } 160 165 } 161 166 162 167 // this must return 0 as we only trained shorter sequences 163 assertEquals(0, fixture.getCount(Arrays.asList(session.get(0), session.get(1), 164 session.get(2)))); 168 assertEquals(0, fixture.getCount(Arrays.asList(session.get(0).getTask(), 169 session.get(1).getTask(), 170 session.get(2).getTask()))); 165 171 166 172 assertEquals(1, fixture.getNumSymbols()); … … 183 189 // subsequences of length 1 are not trained. So the single item sequence of the last 184 190 // task is not counted. Therefore, the result must be 3 185 assertEquals(2, fixture.getCount(Arrays.asList(session.get(0)))); 186 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1)))); 187 assertEquals(2, fixture.getCount(Arrays.asList(session.get(2)))); 188 assertEquals(1, fixture.getCount(Arrays.asList(session.get(3)))); 189 190 assertEquals(2, fixture.getCount(Arrays.asList(session.get(0), session.get(1)))); 191 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1), session.get(2)))); 192 assertEquals(2, fixture.getCount(Arrays.asList(session.get(2), session.get(3)))); 191 assertEquals(2, fixture.getCount(Arrays.asList(session.get(0).getTask()))); 192 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask()))); 193 assertEquals(2, fixture.getCount(Arrays.asList(session.get(2).getTask()))); 194 assertEquals(1, fixture.getCount(Arrays.asList(session.get(3).getTask()))); 195 196 assertEquals(2, fixture.getCount(Arrays.asList(session.get(0).getTask(), 197 session.get(1).getTask()))); 198 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask(), 199 session.get(2).getTask()))); 200 assertEquals(2, fixture.getCount(Arrays.asList(session.get(2).getTask(), 201 session.get(3).getTask()))); 193 202 194 203 // this must return 0 as we only trained shorter sequences 195 assertEquals(0, fixture.getCount(Arrays.asList(session.get(0), session.get(1), 196 session.get(2)))); 204 assertEquals(0, fixture.getCount(Arrays.asList(session.get(0).getTask(), 205 session.get(1).getTask(), 206 session.get(2).getTask()))); 197 207 198 208 assertEquals(2, fixture.getNumSymbols()); … … 213 223 fixture.trainSessions(Arrays.asList(session), 3); 214 224 215 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0) )));216 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1) )));217 assertEquals(1, fixture.getCount(Arrays.asList(session.get(2) )));225 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0).getTask()))); 226 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask()))); 227 assertEquals(1, fixture.getCount(Arrays.asList(session.get(2).getTask()))); 218 228 219 229 // subsequences of length 1 are not trained. So for the single item sequence of the last 220 230 // task, the count must be 0 221 assertEquals(0, fixture.getCount(Arrays.asList(session.get(3)))); 222 223 224 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0), session.get(1)))); 225 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1), session.get(2)))); 226 assertEquals(1, fixture.getCount(Arrays.asList(session.get(2), session.get(3)))); 227 228 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0), session.get(1), 229 session.get(2)))); 230 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1), session.get(2), 231 session.get(3)))); 231 assertEquals(0, fixture.getCount(Arrays.asList(session.get(3).getTask()))); 232 233 234 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0).getTask(), 235 session.get(1).getTask()))); 236 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask(), 237 session.get(2).getTask()))); 238 assertEquals(1, fixture.getCount(Arrays.asList(session.get(2).getTask(), 239 session.get(3).getTask()))); 240 241 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0).getTask(), 242 session.get(1).getTask(), 243 session.get(2).getTask()))); 244 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask(), 245 session.get(2).getTask(), 246 session.get(3).getTask()))); 232 247 233 248 // we only trained shorter sequences, so we expect a count of 0 for longer ones 234 assertEquals(0, fixture.getCount(Arrays.asList(session.get(0), session.get(1), 235 session.get(2), session.get(3)))); 249 assertEquals(0, fixture.getCount(Arrays.asList(session.get(0).getTask(), 250 session.get(1).getTask(), 251 session.get(2).getTask(), 252 session.get(3).getTask()))); 236 253 237 254 // subsequences of length 1 are not trained. So the single item sequence of the last … … 257 274 // subsequences of length 1 are not trained. So the single item sequence of the last 258 275 // task is not counted. Therefore, the result must be 3 259 assertEquals(3, fixture.getCount(Arrays.asList(session.get(i) )));276 assertEquals(3, fixture.getCount(Arrays.asList(session.get(i).getTask()))); 260 277 261 278 for (int j = 0; j < session.size(); j++) { 262 assertEquals(3, fixture.getCount(Arrays.asList(session.get(i), session.get(j)))); 279 assertEquals(3, fixture.getCount(Arrays.asList(session.get(i).getTask(), 280 session.get(j).getTask()))); 263 281 264 282 for (int k = 0; k < session.size(); k++) { 265 assertEquals(2, fixture.getCount(Arrays.asList(session.get(i), session.get(j), 266 session.get(k)))); 283 assertEquals(2, fixture.getCount(Arrays.asList(session.get(i).getTask(), 284 session.get(j).getTask(), 285 session.get(k).getTask()))); 267 286 } 268 287 } … … 270 289 271 290 // we only trained shorter sequences, so we expect a count of 0 for longer ones 272 assertEquals(0, fixture.getCount(Arrays.asList(session.get(0), session.get(1), 273 session.get(2), session.get(3)))); 291 assertEquals(0, fixture.getCount(Arrays.asList(session.get(0).getTask(), 292 session.get(1).getTask(), 293 session.get(2).getTask(), 294 session.get(3).getTask()))); 274 295 275 296 assertEquals(1, fixture.getNumSymbols()); … … 292 313 // subsequences of length 1 are not trained. So the single item sequence of the last 293 314 // task is not counted. Therefore, the result must be 3 294 assertEquals(2, fixture.getCount(Arrays.asList(session.get(0)))); 295 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1)))); 296 assertEquals(2, fixture.getCount(Arrays.asList(session.get(2)))); 297 assertEquals(1, fixture.getCount(Arrays.asList(session.get(3)))); 298 299 assertEquals(2, fixture.getCount(Arrays.asList(session.get(0), session.get(1)))); 300 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1), session.get(2)))); 301 assertEquals(2, fixture.getCount(Arrays.asList(session.get(2), session.get(3)))); 302 303 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0), session.get(1), 304 session.get(2)))); 305 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1), session.get(2), 306 session.get(3)))); 315 assertEquals(2, fixture.getCount(Arrays.asList(session.get(0).getTask()))); 316 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask()))); 317 assertEquals(2, fixture.getCount(Arrays.asList(session.get(2).getTask()))); 318 assertEquals(1, fixture.getCount(Arrays.asList(session.get(3).getTask()))); 319 320 assertEquals(2, fixture.getCount(Arrays.asList(session.get(0).getTask(), 321 session.get(1).getTask()))); 322 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask(), 323 session.get(2).getTask()))); 324 assertEquals(2, fixture.getCount(Arrays.asList(session.get(2).getTask(), 325 session.get(3).getTask()))); 326 327 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0).getTask(), 328 session.get(1).getTask(), 329 session.get(2).getTask()))); 330 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask(), 331 session.get(2).getTask(), 332 session.get(3).getTask()))); 307 333 308 334 // we only trained shorter sequences, so we expect a count of 0 for longer ones 309 assertEquals(0, fixture.getCount(Arrays.asList(session.get(0), session.get(1), 310 session.get(2), session.get(3)))); 335 assertEquals(0, fixture.getCount(Arrays.asList(session.get(0).getTask(), 336 session.get(1).getTask(), 337 session.get(2).getTask(), 338 session.get(3).getTask()))); 311 339 312 340 assertEquals(2, fixture.getNumSymbols()); … … 327 355 fixture.trainSessions(Arrays.asList(session), 4); 328 356 329 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0) )));330 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1) )));331 assertEquals(1, fixture.getCount(Arrays.asList(session.get(2) )));357 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0).getTask()))); 358 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask()))); 359 assertEquals(1, fixture.getCount(Arrays.asList(session.get(2).getTask()))); 332 360 333 361 // subsequences of length 1 are not trained. So for the single item sequence of the last 334 362 // task, the count must be 0 335 assertEquals(0, fixture.getCount(Arrays.asList(session.get(3)))); 336 337 338 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0), session.get(1)))); 339 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1), session.get(2)))); 340 assertEquals(1, fixture.getCount(Arrays.asList(session.get(2), session.get(3)))); 341 342 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0), session.get(1), 343 session.get(2)))); 344 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1), session.get(2), 345 session.get(3)))); 363 assertEquals(0, fixture.getCount(Arrays.asList(session.get(3).getTask()))); 364 365 366 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0).getTask(), 367 session.get(1).getTask()))); 368 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask(), 369 session.get(2).getTask()))); 370 assertEquals(1, fixture.getCount(Arrays.asList(session.get(2).getTask(), 371 session.get(3).getTask()))); 372 373 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0).getTask(), 374 session.get(1).getTask(), 375 session.get(2).getTask()))); 376 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask(), 377 session.get(2).getTask(), 378 session.get(3).getTask()))); 346 379 347 380 // we only trained shorter sequences, so we expect a count of 0 for longer ones 348 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0), session.get(1), 349 session.get(2), session.get(3)))); 381 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0).getTask(), 382 session.get(1).getTask(), 383 session.get(2).getTask(), 384 session.get(3).getTask()))); 350 385 351 386 // subsequences of length 1 are not trained. So the single item sequence of the last … … 371 406 // subsequences of length 1 are not trained. So the single item sequence of the last 372 407 // task is not counted. Therefore, the result must be 3 373 assertEquals(3, fixture.getCount(Arrays.asList(session.get(i) )));408 assertEquals(3, fixture.getCount(Arrays.asList(session.get(i).getTask()))); 374 409 375 410 for (int j = 0; j < session.size(); j++) { 376 assertEquals(3, fixture.getCount(Arrays.asList(session.get(i), session.get(j)))); 411 assertEquals(3, fixture.getCount(Arrays.asList(session.get(i).getTask(), 412 session.get(j).getTask()))); 377 413 378 414 for (int k = 0; k < session.size(); k++) { 379 assertEquals(2, fixture.getCount(Arrays.asList(session.get(i), session.get(j), 380 session.get(k)))); 415 assertEquals(2, fixture.getCount(Arrays.asList(session.get(i).getTask(), 416 session.get(j).getTask(), 417 session.get(k).getTask()))); 381 418 } 382 419 } … … 384 421 385 422 // we only trained shorter sequences, so we expect a count of 0 for longer ones 386 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0), session.get(1), 387 session.get(2), session.get(3)))); 423 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0).getTask(), 424 session.get(1).getTask(), 425 session.get(2).getTask(), 426 session.get(3).getTask()))); 388 427 389 428 assertEquals(1, fixture.getNumSymbols()); … … 406 445 // subsequences of length 1 are not trained. So the single item sequence of the last 407 446 // task is not counted. Therefore, the result must be 3 408 assertEquals(2, fixture.getCount(Arrays.asList(session.get(0)))); 409 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1)))); 410 assertEquals(2, fixture.getCount(Arrays.asList(session.get(2)))); 411 assertEquals(1, fixture.getCount(Arrays.asList(session.get(3)))); 412 413 assertEquals(2, fixture.getCount(Arrays.asList(session.get(0), session.get(1)))); 414 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1), session.get(2)))); 415 assertEquals(2, fixture.getCount(Arrays.asList(session.get(2), session.get(3)))); 416 417 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0), session.get(1), 418 session.get(2)))); 419 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1), session.get(2), 420 session.get(3)))); 447 assertEquals(2, fixture.getCount(Arrays.asList(session.get(0).getTask()))); 448 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask()))); 449 assertEquals(2, fixture.getCount(Arrays.asList(session.get(2).getTask()))); 450 assertEquals(1, fixture.getCount(Arrays.asList(session.get(3).getTask()))); 451 452 assertEquals(2, fixture.getCount(Arrays.asList(session.get(0).getTask(), 453 session.get(1).getTask()))); 454 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask(), 455 session.get(2).getTask()))); 456 assertEquals(2, fixture.getCount(Arrays.asList(session.get(2).getTask(), 457 session.get(3).getTask()))); 458 459 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0).getTask(), 460 session.get(1).getTask(), 461 session.get(2).getTask()))); 462 assertEquals(1, fixture.getCount(Arrays.asList(session.get(1).getTask(), 463 session.get(2).getTask(), 464 session.get(3).getTask()))); 421 465 422 466 // we only trained shorter sequences, so we expect a count of 0 for longer ones 423 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0), session.get(1), 424 session.get(2), session.get(3)))); 467 assertEquals(1, fixture.getCount(Arrays.asList(session.get(0).getTask(), 468 session.get(1).getTask(), 469 session.get(2).getTask(), 470 session.get(3).getTask()))); 425 471 426 472 assertEquals(2, fixture.getNumSymbols()); … … 435 481 436 482 // get all sequences with a minimal length of one that occur most often 437 Collection<List<ITask Instance>> result = fixture.getSequencesWithOccurrenceCount(1, 0);483 Collection<List<ITask>> result = fixture.getSequencesWithOccurrenceCount(1, 0); 438 484 439 485 assertEquals(1, result.size()); 440 486 441 List<ITask Instance> expected = new ArrayList<ITaskInstance>();442 expected.add(session.get(0) );443 444 assertContains((List<List<ITask Instance>>) result, expected);487 List<ITask> expected = new ArrayList<ITask>(); 488 expected.add(session.get(0).getTask()); 489 490 assertContains((List<List<ITask>>) result, expected); 445 491 } 446 492 … … 452 498 453 499 // get all sequences with a minimal length of one that occur exactly once 454 Collection<List<ITask Instance>> result = fixture.getSequencesWithOccurrenceCount(1, 1);500 Collection<List<ITask>> result = fixture.getSequencesWithOccurrenceCount(1, 1); 455 501 456 502 assertEquals(11, result.size()); 457 503 458 List<ITask Instance> expected = new ArrayList<ITaskInstance>();459 expected.add(session.get(2) ); //r460 expected.add(session.get(0) ); //a461 expected.add(session.get(4) ); //c504 List<ITask> expected = new ArrayList<ITask>(); 505 expected.add(session.get(2).getTask()); //r 506 expected.add(session.get(0).getTask()); //a 507 expected.add(session.get(4).getTask()); //c 462 508 // rac 463 assertContains((List<List<ITask Instance>>) result, expected);464 465 expected.clear(); 466 expected.add(session.get(0) ); //a467 expected.add(session.get(4) ); //c509 assertContains((List<List<ITask>>) result, expected); 510 511 expected.clear(); 512 expected.add(session.get(0).getTask()); //a 513 expected.add(session.get(4).getTask()); //c 468 514 // ac 469 assertContains((List<List<ITask Instance>>) result, expected);470 471 expected.add(session.get(0) ); //a515 assertContains((List<List<ITask>>) result, expected); 516 517 expected.add(session.get(0).getTask()); //a 472 518 // aca 473 assertContains((List<List<ITask Instance>>) result, expected);474 475 expected.clear(); 476 expected.add(session.get(4) ); //c519 assertContains((List<List<ITask>>) result, expected); 520 521 expected.clear(); 522 expected.add(session.get(4).getTask()); //c 477 523 // c 478 assertContains((List<List<ITask Instance>>) result, expected);479 480 expected.add(session.get(0) ); //a524 assertContains((List<List<ITask>>) result, expected); 525 526 expected.add(session.get(0).getTask()); //a 481 527 // ca 482 assertContains((List<List<ITask Instance>>) result, expected);483 484 expected.add(session.get(6) ); //d528 assertContains((List<List<ITask>>) result, expected); 529 530 expected.add(session.get(6).getTask()); //d 485 531 // cad 486 assertContains((List<List<ITask Instance>>) result, expected);487 488 expected.clear(); 489 expected.add(session.get(0) ); //a490 expected.add(session.get(6) ); //d532 assertContains((List<List<ITask>>) result, expected); 533 534 expected.clear(); 535 expected.add(session.get(0).getTask()); //a 536 expected.add(session.get(6).getTask()); //d 491 537 // ad 492 assertContains((List<List<ITask Instance>>) result, expected);493 494 expected.add(session.get(0) ); //a538 assertContains((List<List<ITask>>) result, expected); 539 540 expected.add(session.get(0).getTask()); //a 495 541 // ada 496 assertContains((List<List<ITask Instance>>) result, expected);497 498 expected.clear(); 499 expected.add(session.get(6) ); //d542 assertContains((List<List<ITask>>) result, expected); 543 544 expected.clear(); 545 expected.add(session.get(6).getTask()); //d 500 546 // d 501 assertContains((List<List<ITask Instance>>) result, expected);502 503 expected.add(session.get(0) ); //a547 assertContains((List<List<ITask>>) result, expected); 548 549 expected.add(session.get(0).getTask()); //a 504 550 // da 505 assertContains((List<List<ITask Instance>>) result, expected);506 507 expected.add(session.get(1) ); //b551 assertContains((List<List<ITask>>) result, expected); 552 553 expected.add(session.get(1).getTask()); //b 508 554 // dab 509 assertContains((List<List<ITask Instance>>) result, expected);555 assertContains((List<List<ITask>>) result, expected); 510 556 } 511 557 … … 517 563 518 564 // get all sequences with a minimal length of one that occur exactly twice 519 Collection<List<ITask Instance>> result = fixture.getSequencesWithOccurrenceCount(1, 2);565 Collection<List<ITask>> result = fixture.getSequencesWithOccurrenceCount(1, 2); 520 566 521 567 assertEquals(7, result.size()); 522 568 523 List<ITask Instance> expected = new ArrayList<ITaskInstance>();524 expected.add(session.get(0) ); //a525 expected.add(session.get(1) ); //b569 List<ITask> expected = new ArrayList<ITask>(); 570 expected.add(session.get(0).getTask()); //a 571 expected.add(session.get(1).getTask()); //b 526 572 // ab 527 assertContains((List<List<ITask Instance>>) result, expected);528 529 expected.add(session.get(2) ); //r573 assertContains((List<List<ITask>>) result, expected); 574 575 expected.add(session.get(2).getTask()); //r 530 576 // abr 531 assertContains((List<List<ITask Instance>>) result, expected);532 533 expected.clear(); 534 expected.add(session.get(1) ); //b577 assertContains((List<List<ITask>>) result, expected); 578 579 expected.clear(); 580 expected.add(session.get(1).getTask()); //b 535 581 // b 536 assertContains((List<List<ITask Instance>>) result, expected);537 538 expected.add(session.get(2) ); //r582 assertContains((List<List<ITask>>) result, expected); 583 584 expected.add(session.get(2).getTask()); //r 539 585 // br 540 assertContains((List<List<ITask Instance>>) result, expected);541 542 expected.add(session.get(0) ); //a586 assertContains((List<List<ITask>>) result, expected); 587 588 expected.add(session.get(0).getTask()); //a 543 589 // bra 544 assertContains((List<List<ITask Instance>>) result, expected);545 546 expected.clear(); 547 expected.add(session.get(2) ); //r590 assertContains((List<List<ITask>>) result, expected); 591 592 expected.clear(); 593 expected.add(session.get(2).getTask()); //r 548 594 // r 549 assertContains((List<List<ITask Instance>>) result, expected);550 551 expected.add(session.get(0) ); //a595 assertContains((List<List<ITask>>) result, expected); 596 597 expected.add(session.get(0).getTask()); //a 552 598 // ra 553 assertContains((List<List<ITask Instance>>) result, expected);599 assertContains((List<List<ITask>>) result, expected); 554 600 } 555 601 … … 561 607 562 608 // get all sequences with a minimal length of one that occur exactly three times 563 Collection<List<ITask Instance>> result = fixture.getSequencesWithOccurrenceCount(1, 3);609 Collection<List<ITask>> result = fixture.getSequencesWithOccurrenceCount(1, 3); 564 610 565 611 assertEquals(0, result.size()); … … 573 619 574 620 // get all sequences with a minimal length of one that occur exactly four times 575 Collection<List<ITask Instance>> result = fixture.getSequencesWithOccurrenceCount(1, 4);621 Collection<List<ITask>> result = fixture.getSequencesWithOccurrenceCount(1, 4); 576 622 577 623 // as we did not train the last single action, we may expect the "a" action only 4 times 578 624 assertEquals(1, result.size()); 579 625 580 List<ITask Instance> expected = new ArrayList<ITaskInstance>();581 expected.add(session.get(0) ); //a582 assertContains((List<List<ITask Instance>>) result, expected);626 List<ITask> expected = new ArrayList<ITask>(); 627 expected.add(session.get(0).getTask()); //a 628 assertContains((List<List<ITask>>) result, expected); 583 629 } 584 630 … … 590 636 591 637 // get all sequences with a minimal length of one that occur exactly five times 592 Collection<List<ITask Instance>> result = fixture.getSequencesWithOccurrenceCount(1, 5);638 Collection<List<ITask>> result = fixture.getSequencesWithOccurrenceCount(1, 5); 593 639 594 640 // as we did not train the last single action, we may expect the "a" action only 4 times … … 603 649 604 650 // get all sequences with a minimal length of two that occur most often 605 Collection<List<ITask Instance>> result = fixture.getSequencesWithOccurrenceCount(2, 0);651 Collection<List<ITask>> result = fixture.getSequencesWithOccurrenceCount(2, 0); 606 652 607 653 assertEquals(5, result.size()); 608 654 609 List<ITask Instance> expected = new ArrayList<ITaskInstance>();610 expected.add(session.get(0) ); //a611 expected.add(session.get(1) ); //b612 assertContains((List<List<ITask Instance>>) result, expected);613 614 expected.add(session.get(2) ); //r615 assertContains((List<List<ITask Instance>>) result, expected);616 617 expected.clear(); 618 expected.add(session.get(1) ); //b619 expected.add(session.get(2) ); //r620 assertContains((List<List<ITask Instance>>) result, expected);621 622 expected.add(session.get(0) ); //a623 assertContains((List<List<ITask Instance>>) result, expected);624 625 expected.clear(); 626 expected.add(session.get(2) ); //r627 expected.add(session.get(0) ); //a628 assertContains((List<List<ITask Instance>>) result, expected);655 List<ITask> expected = new ArrayList<ITask>(); 656 expected.add(session.get(0).getTask()); //a 657 expected.add(session.get(1).getTask()); //b 658 assertContains((List<List<ITask>>) result, expected); 659 660 expected.add(session.get(2).getTask()); //r 661 assertContains((List<List<ITask>>) result, expected); 662 663 expected.clear(); 664 expected.add(session.get(1).getTask()); //b 665 expected.add(session.get(2).getTask()); //r 666 assertContains((List<List<ITask>>) result, expected); 667 668 expected.add(session.get(0).getTask()); //a 669 assertContains((List<List<ITask>>) result, expected); 670 671 expected.clear(); 672 expected.add(session.get(2).getTask()); //r 673 expected.add(session.get(0).getTask()); //a 674 assertContains((List<List<ITask>>) result, expected); 629 675 } 630 676 … … 636 682 637 683 // get all sequences with a minimal length of two that occur exactly once 638 Collection<List<ITask Instance>> result = fixture.getSequencesWithOccurrenceCount(2, 1);684 Collection<List<ITask>> result = fixture.getSequencesWithOccurrenceCount(2, 1); 639 685 640 686 assertEquals(9, result.size()); 641 687 642 List<ITask Instance> expected = new ArrayList<ITaskInstance>();643 expected.add(session.get(2) ); //r644 expected.add(session.get(0) ); //a645 expected.add(session.get(4) ); //c688 List<ITask> expected = new ArrayList<ITask>(); 689 expected.add(session.get(2).getTask()); //r 690 expected.add(session.get(0).getTask()); //a 691 expected.add(session.get(4).getTask()); //c 646 692 // rac 647 assertContains((List<List<ITask Instance>>) result, expected);648 649 expected.clear(); 650 expected.add(session.get(0) ); //a651 expected.add(session.get(4) ); //c693 assertContains((List<List<ITask>>) result, expected); 694 695 expected.clear(); 696 expected.add(session.get(0).getTask()); //a 697 expected.add(session.get(4).getTask()); //c 652 698 // ac 653 assertContains((List<List<ITask Instance>>) result, expected);654 655 expected.add(session.get(0) ); //a699 assertContains((List<List<ITask>>) result, expected); 700 701 expected.add(session.get(0).getTask()); //a 656 702 // aca 657 assertContains((List<List<ITask Instance>>) result, expected);658 659 expected.clear(); 660 expected.add(session.get(4) ); //c661 expected.add(session.get(0) ); //a703 assertContains((List<List<ITask>>) result, expected); 704 705 expected.clear(); 706 expected.add(session.get(4).getTask()); //c 707 expected.add(session.get(0).getTask()); //a 662 708 // ca 663 assertContains((List<List<ITask Instance>>) result, expected);664 665 expected.add(session.get(6) ); //d709 assertContains((List<List<ITask>>) result, expected); 710 711 expected.add(session.get(6).getTask()); //d 666 712 // cad 667 assertContains((List<List<ITask Instance>>) result, expected);668 669 expected.clear(); 670 expected.add(session.get(0) ); //a671 expected.add(session.get(6) ); //d713 assertContains((List<List<ITask>>) result, expected); 714 715 expected.clear(); 716 expected.add(session.get(0).getTask()); //a 717 expected.add(session.get(6).getTask()); //d 672 718 // ad 673 assertContains((List<List<ITask Instance>>) result, expected);674 675 expected.add(session.get(0) ); //a719 assertContains((List<List<ITask>>) result, expected); 720 721 expected.add(session.get(0).getTask()); //a 676 722 // ada 677 assertContains((List<List<ITask Instance>>) result, expected);678 679 expected.clear(); 680 expected.add(session.get(6) ); //d681 expected.add(session.get(0) ); //a723 assertContains((List<List<ITask>>) result, expected); 724 725 expected.clear(); 726 expected.add(session.get(6).getTask()); //d 727 expected.add(session.get(0).getTask()); //a 682 728 // da 683 assertContains((List<List<ITask Instance>>) result, expected);684 685 expected.add(session.get(1) ); //b729 assertContains((List<List<ITask>>) result, expected); 730 731 expected.add(session.get(1).getTask()); //b 686 732 // dab 687 assertContains((List<List<ITask Instance>>) result, expected);733 assertContains((List<List<ITask>>) result, expected); 688 734 } 689 735 … … 695 741 696 742 // get all sequences with a minimal length of two that occur exactly twice 697 Collection<List<ITask Instance>> result = fixture.getSequencesWithOccurrenceCount(2, 2);743 Collection<List<ITask>> result = fixture.getSequencesWithOccurrenceCount(2, 2); 698 744 699 745 assertEquals(5, result.size()); 700 746 701 List<ITask Instance> expected = new ArrayList<ITaskInstance>();702 expected.add(session.get(0) ); //a703 expected.add(session.get(1) ); //b747 List<ITask> expected = new ArrayList<ITask>(); 748 expected.add(session.get(0).getTask()); //a 749 expected.add(session.get(1).getTask()); //b 704 750 // ab 705 assertContains((List<List<ITask Instance>>) result, expected);706 707 expected.add(session.get(2) ); //r751 assertContains((List<List<ITask>>) result, expected); 752 753 expected.add(session.get(2).getTask()); //r 708 754 // abr 709 assertContains((List<List<ITask Instance>>) result, expected);710 711 expected.clear(); 712 expected.add(session.get(1) ); //b713 expected.add(session.get(2) ); //r755 assertContains((List<List<ITask>>) result, expected); 756 757 expected.clear(); 758 expected.add(session.get(1).getTask()); //b 759 expected.add(session.get(2).getTask()); //r 714 760 // br 715 assertContains((List<List<ITask Instance>>) result, expected);716 717 expected.add(session.get(0) ); //a761 assertContains((List<List<ITask>>) result, expected); 762 763 expected.add(session.get(0).getTask()); //a 718 764 // bra 719 assertContains((List<List<ITask Instance>>) result, expected);720 721 expected.clear(); 722 expected.add(session.get(2) ); //r723 expected.add(session.get(0) ); //a765 assertContains((List<List<ITask>>) result, expected); 766 767 expected.clear(); 768 expected.add(session.get(2).getTask()); //r 769 expected.add(session.get(0).getTask()); //a 724 770 // ra 725 assertContains((List<List<ITask Instance>>) result, expected);771 assertContains((List<List<ITask>>) result, expected); 726 772 } 727 773 … … 733 779 734 780 // get all sequences with a minimal length of two that occur exactly three times 735 Collection<List<ITask Instance>> result = fixture.getSequencesWithOccurrenceCount(2, 3);781 Collection<List<ITask>> result = fixture.getSequencesWithOccurrenceCount(2, 3); 736 782 737 783 assertEquals(0, result.size()); … … 745 791 746 792 // get all sequences with a minimal length of three that occur most often 747 Collection<List<ITask Instance>> result = fixture.getSequencesWithOccurrenceCount(3, 0);793 Collection<List<ITask>> result = fixture.getSequencesWithOccurrenceCount(3, 0); 748 794 749 795 assertEquals(2, result.size()); 750 796 751 List<ITask Instance> expected = new ArrayList<ITaskInstance>();752 expected.add(session.get(0) ); //a753 expected.add(session.get(1) ); //b754 expected.add(session.get(2) ); //r755 assertContains((List<List<ITask Instance>>) result, expected);756 757 expected.clear(); 758 expected.add(session.get(1) ); //b759 expected.add(session.get(2) ); //r760 expected.add(session.get(0) ); //a761 assertContains((List<List<ITask Instance>>) result, expected);797 List<ITask> expected = new ArrayList<ITask>(); 798 expected.add(session.get(0).getTask()); //a 799 expected.add(session.get(1).getTask()); //b 800 expected.add(session.get(2).getTask()); //r 801 assertContains((List<List<ITask>>) result, expected); 802 803 expected.clear(); 804 expected.add(session.get(1).getTask()); //b 805 expected.add(session.get(2).getTask()); //r 806 expected.add(session.get(0).getTask()); //a 807 assertContains((List<List<ITask>>) result, expected); 762 808 } 763 809 … … 769 815 770 816 // get all sequences with a minimal length of three that occur exactly once 771 Collection<List<ITask Instance>> result = fixture.getSequencesWithOccurrenceCount(3, 1);817 Collection<List<ITask>> result = fixture.getSequencesWithOccurrenceCount(3, 1); 772 818 773 819 assertEquals(5, result.size()); 774 820 775 List<ITask Instance> expected = new ArrayList<ITaskInstance>();776 expected.add(session.get(2) ); //r777 expected.add(session.get(0) ); //a778 expected.add(session.get(4) ); //c821 List<ITask> expected = new ArrayList<ITask>(); 822 expected.add(session.get(2).getTask()); //r 823 expected.add(session.get(0).getTask()); //a 824 expected.add(session.get(4).getTask()); //c 779 825 // rac 780 assertContains((List<List<ITask Instance>>) result, expected);781 782 expected.clear(); 783 expected.add(session.get(0) ); //a784 expected.add(session.get(4) ); //c785 expected.add(session.get(0) ); //a826 assertContains((List<List<ITask>>) result, expected); 827 828 expected.clear(); 829 expected.add(session.get(0).getTask()); //a 830 expected.add(session.get(4).getTask()); //c 831 expected.add(session.get(0).getTask()); //a 786 832 // aca 787 assertContains((List<List<ITask Instance>>) result, expected);788 789 expected.clear(); 790 expected.add(session.get(4) ); //c791 expected.add(session.get(0) ); //a792 expected.add(session.get(6) ); //d833 assertContains((List<List<ITask>>) result, expected); 834 835 expected.clear(); 836 expected.add(session.get(4).getTask()); //c 837 expected.add(session.get(0).getTask()); //a 838 expected.add(session.get(6).getTask()); //d 793 839 // cad 794 assertContains((List<List<ITask Instance>>) result, expected);795 796 expected.clear(); 797 expected.add(session.get(0) ); //a798 expected.add(session.get(6) ); //d799 expected.add(session.get(0) ); //a840 assertContains((List<List<ITask>>) result, expected); 841 842 expected.clear(); 843 expected.add(session.get(0).getTask()); //a 844 expected.add(session.get(6).getTask()); //d 845 expected.add(session.get(0).getTask()); //a 800 846 // ada 801 assertContains((List<List<ITask Instance>>) result, expected);802 803 expected.clear(); 804 expected.add(session.get(6) ); //d805 expected.add(session.get(0) ); //a806 expected.add(session.get(1) ); //b847 assertContains((List<List<ITask>>) result, expected); 848 849 expected.clear(); 850 expected.add(session.get(6).getTask()); //d 851 expected.add(session.get(0).getTask()); //a 852 expected.add(session.get(1).getTask()); //b 807 853 // dab 808 assertContains((List<List<ITask Instance>>) result, expected);854 assertContains((List<List<ITask>>) result, expected); 809 855 } 810 856 … … 816 862 817 863 // get all sequences with a minimal length of four that occur most often 818 Collection<List<ITask Instance>> result = fixture.getSequencesWithOccurrenceCount(4, 0);864 Collection<List<ITask>> result = fixture.getSequencesWithOccurrenceCount(4, 0); 819 865 820 866 // none of these exist, as the tree is only trained with sequences of length 3 … … 829 875 830 876 // get all sequences with a minimal length of four that occur exactly once 831 Collection<List<ITask Instance>> result = fixture.getSequencesWithOccurrenceCount(4, 1);877 Collection<List<ITask>> result = fixture.getSequencesWithOccurrenceCount(4, 1); 832 878 833 879 // none of these exist, as the tree is only trained with sequences of length 3 … … 841 887 fixture.trainSessions(Arrays.asList(session), 3); 842 888 843 List<ITask Instance> subSequence = new ArrayList<ITaskInstance>();844 subSequence.add(session.get(0) ); //a889 List<ITask> subSequence = new ArrayList<ITask>(); 890 subSequence.add(session.get(0).getTask()); //a 845 891 846 892 int result = fixture.getCount(subSequence); … … 856 902 fixture.trainSessions(Arrays.asList(session), 3); 857 903 858 List<ITask Instance> subSequence = new ArrayList<ITaskInstance>();859 subSequence.add(session.get(0) ); //a860 subSequence.add(session.get(1) ); //b904 List<ITask> subSequence = new ArrayList<ITask>(); 905 subSequence.add(session.get(0).getTask()); //a 906 subSequence.add(session.get(1).getTask()); //b 861 907 862 908 int result = fixture.getCount(subSequence); … … 871 917 fixture.trainSessions(Arrays.asList(session), 3); 872 918 873 List<ITask Instance> subSequence = new ArrayList<ITaskInstance>();874 subSequence.add(taskFactory.createNew TaskInstance(taskFactory.createNewSequence()));919 List<ITask> subSequence = new ArrayList<ITask>(); 920 subSequence.add(taskFactory.createNewSequence()); 875 921 876 922 int result = fixture.getCount(subSequence); … … 885 931 fixture.trainSessions(Arrays.asList(session), 3); 886 932 887 List<ITask Instance> subSequence = new ArrayList<ITaskInstance>();888 889 int result = fixture.getCount(subSequence, session.get(0) ); //a933 List<ITask> subSequence = new ArrayList<ITask>(); 934 935 int result = fixture.getCount(subSequence, session.get(0).getTask()); //a 890 936 891 937 // as we did not train the last single action, we may expect the "a" action only 4 times … … 899 945 fixture.trainSessions(Arrays.asList(session), 3); 900 946 901 List<ITask Instance> subSequence = new ArrayList<ITaskInstance>();902 subSequence.add(session.get(0) ); //a903 subSequence.add(session.get(1) ); //b904 905 int result = fixture.getCount(subSequence, session.get(2) ); //r947 List<ITask> subSequence = new ArrayList<ITask>(); 948 subSequence.add(session.get(0).getTask()); //a 949 subSequence.add(session.get(1).getTask()); //b 950 951 int result = fixture.getCount(subSequence, session.get(2).getTask()); //r 906 952 907 953 assertEquals(2, result); … … 914 960 fixture.trainSessions(Arrays.asList(session), 3); 915 961 916 List<ITask Instance> subSequence = new ArrayList<ITaskInstance>();962 List<ITask> subSequence = new ArrayList<ITask>(); 917 963 918 964 int result = fixture.getCount 919 (subSequence, taskFactory.createNew TaskInstance(taskFactory.createNewSequence()));965 (subSequence, taskFactory.createNewSequence()); 920 966 921 967 assertEquals(0, result); … … 928 974 fixture.trainSessions(Arrays.asList(session), 3); 929 975 930 List<ITask Instance> subSequence = new ArrayList<ITaskInstance>();931 subSequence.add(session.get(0) ); //a932 Collection<ITask Instance> expected = new ArrayList<ITaskInstance>();933 expected.add(session.get(1) ); //b934 expected.add(session.get(4) ); //c935 expected.add(session.get(6) ); //d936 937 Collection<ITask Instance> result = fixture.getFollowingSymbols(subSequence);976 List<ITask> subSequence = new ArrayList<ITask>(); 977 subSequence.add(session.get(0).getTask()); //a 978 Collection<ITask> expected = new ArrayList<ITask>(); 979 expected.add(session.get(1).getTask()); //b 980 expected.add(session.get(4).getTask()); //c 981 expected.add(session.get(6).getTask()); //d 982 983 Collection<ITask> result = fixture.getFollowingSymbols(subSequence); 938 984 939 985 assertCollectionContent(expected, result); … … 946 992 fixture.trainSessions(Arrays.asList(session), 3); 947 993 948 List<ITask Instance> subSequence = new ArrayList<ITaskInstance>();949 subSequence.add(session.get(0) ); //a950 subSequence.add(session.get(1) ); //b951 subSequence.add(session.get(2) ); //r952 953 Collection<ITask Instance> result = fixture.getFollowingSymbols(subSequence);994 List<ITask> subSequence = new ArrayList<ITask>(); 995 subSequence.add(session.get(0).getTask()); //a 996 subSequence.add(session.get(1).getTask()); //b 997 subSequence.add(session.get(2).getTask()); //r 998 999 Collection<ITask> result = fixture.getFollowingSymbols(subSequence); 954 1000 955 1001 assertEquals(0, result.size()); … … 962 1008 fixture.trainSessions(Arrays.asList(session), 3); 963 1009 964 List<ITask Instance> subSequence = new ArrayList<ITaskInstance>();965 subSequence.add(taskFactory.createNew TaskInstance(taskFactory.createNewSequence()));966 967 Collection<ITask Instance> result = fixture.getFollowingSymbols(subSequence);1010 List<ITask> subSequence = new ArrayList<ITask>(); 1011 subSequence.add(taskFactory.createNewSequence()); 1012 1013 Collection<ITask> result = fixture.getFollowingSymbols(subSequence); 968 1014 969 1015 assertEquals(0, result.size()); … … 1010 1056 int order = 2; 1011 1057 1012 Task InstanceTrieTester tester = new TaskInstanceTrieTester(3, 50, order);1058 TaskTrieTester tester = new TaskTrieTester(3, 50, order); 1013 1059 1014 1060 long start = System.currentTimeMillis(); … … 1030 1076 int order = 2; 1031 1077 1032 Task InstanceTrieTester tester = new TaskInstanceTrieTester(3, 10000, order);1078 TaskTrieTester tester = new TaskTrieTester(3, 10000, order); 1033 1079 1034 1080 long start = System.currentTimeMillis(); … … 1050 1096 int order = 2; 1051 1097 1052 Task InstanceTrieTester tester = new TaskInstanceTrieTester(30, 10000, order);1098 TaskTrieTester tester = new TaskTrieTester(30, 10000, order); 1053 1099 1054 1100 long start = System.currentTimeMillis(); … … 1070 1116 int order = 2; 1071 1117 1072 Task InstanceTrieTester tester = new TaskInstanceTrieTester(300, 10000, order);1118 TaskTrieTester tester = new TaskTrieTester(300, 10000, order); 1073 1119 1074 1120 long start = System.currentTimeMillis(); … … 1090 1136 int order = 2; 1091 1137 1092 Task InstanceTrieTester tester = new TaskInstanceTrieTester(1000, 10000, order);1138 TaskTrieTester tester = new TaskTrieTester(1000, 10000, order); 1093 1139 1094 1140 long start = System.currentTimeMillis(); … … 1110 1156 int order = 3; 1111 1157 1112 Task InstanceTrieTester tester = new TaskInstanceTrieTester(3, 50, order);1158 TaskTrieTester tester = new TaskTrieTester(3, 50, order); 1113 1159 1114 1160 long start = System.currentTimeMillis(); … … 1130 1176 int order = 3; 1131 1177 1132 Task InstanceTrieTester tester = new TaskInstanceTrieTester(3, 10000, order);1178 TaskTrieTester tester = new TaskTrieTester(3, 10000, order); 1133 1179 1134 1180 long start = System.currentTimeMillis(); … … 1150 1196 int order = 3; 1151 1197 1152 Task InstanceTrieTester tester = new TaskInstanceTrieTester(30, 10000, order);1198 TaskTrieTester tester = new TaskTrieTester(30, 10000, order); 1153 1199 1154 1200 long start = System.currentTimeMillis(); … … 1170 1216 int order = 3; 1171 1217 1172 Task InstanceTrieTester tester = new TaskInstanceTrieTester(300, 10000, order);1218 TaskTrieTester tester = new TaskTrieTester(300, 10000, order); 1173 1219 1174 1220 long start = System.currentTimeMillis(); … … 1190 1236 int order = 3; 1191 1237 1192 Task InstanceTrieTester tester = new TaskInstanceTrieTester(1000, 10000, order);1238 TaskTrieTester tester = new TaskTrieTester(1000, 10000, order); 1193 1239 1194 1240 long start = System.currentTimeMillis(); … … 1210 1256 int order = 4; 1211 1257 1212 Task InstanceTrieTester tester = new TaskInstanceTrieTester(3, 50, order);1258 TaskTrieTester tester = new TaskTrieTester(3, 50, order); 1213 1259 1214 1260 long start = System.currentTimeMillis(); … … 1230 1276 int order = 4; 1231 1277 1232 Task InstanceTrieTester tester = new TaskInstanceTrieTester(3, 10000, order);1278 TaskTrieTester tester = new TaskTrieTester(3, 10000, order); 1233 1279 1234 1280 long start = System.currentTimeMillis(); … … 1250 1296 int order = 4; 1251 1297 1252 Task InstanceTrieTester tester = new TaskInstanceTrieTester(30, 10000, order);1298 TaskTrieTester tester = new TaskTrieTester(30, 10000, order); 1253 1299 1254 1300 long start = System.currentTimeMillis(); … … 1270 1316 int order = 4; 1271 1317 1272 Task InstanceTrieTester tester = new TaskInstanceTrieTester(300, 10000, order);1318 TaskTrieTester tester = new TaskTrieTester(300, 10000, order); 1273 1319 1274 1320 long start = System.currentTimeMillis(); … … 1290 1336 int order = 4; 1291 1337 1292 Task InstanceTrieTester tester = new TaskInstanceTrieTester(1000, 10000, order);1338 TaskTrieTester tester = new TaskTrieTester(1000, 10000, order); 1293 1339 1294 1340 long start = System.currentTimeMillis(); … … 1310 1356 int order = 5; 1311 1357 1312 Task InstanceTrieTester tester = new TaskInstanceTrieTester(3, 50, order);1358 TaskTrieTester tester = new TaskTrieTester(3, 50, order); 1313 1359 1314 1360 long start = System.currentTimeMillis(); … … 1330 1376 int order = 5; 1331 1377 1332 Task InstanceTrieTester tester = new TaskInstanceTrieTester(3, 10000, order);1378 TaskTrieTester tester = new TaskTrieTester(3, 10000, order); 1333 1379 1334 1380 long start = System.currentTimeMillis(); … … 1350 1396 int order = 5; 1351 1397 1352 Task InstanceTrieTester tester = new TaskInstanceTrieTester(30, 10000, order);1398 TaskTrieTester tester = new TaskTrieTester(30, 10000, order); 1353 1399 1354 1400 long start = System.currentTimeMillis(); … … 1370 1416 int order = 5; 1371 1417 1372 Task InstanceTrieTester tester = new TaskInstanceTrieTester(300, 10000, order);1418 TaskTrieTester tester = new TaskTrieTester(300, 10000, order); 1373 1419 1374 1420 long start = System.currentTimeMillis(); … … 1390 1436 int order = 5; 1391 1437 1392 Task InstanceTrieTester tester = new TaskInstanceTrieTester(1000, 10000, order);1438 TaskTrieTester tester = new TaskTrieTester(1000, 10000, order); 1393 1439 1394 1440 long start = System.currentTimeMillis(); … … 1410 1456 int order = 6; 1411 1457 1412 Task InstanceTrieTester tester = new TaskInstanceTrieTester(3, 50, order);1458 TaskTrieTester tester = new TaskTrieTester(3, 50, order); 1413 1459 1414 1460 long start = System.currentTimeMillis(); … … 1430 1476 int order = 6; 1431 1477 1432 Task InstanceTrieTester tester = new TaskInstanceTrieTester(3, 10000, order);1478 TaskTrieTester tester = new TaskTrieTester(3, 10000, order); 1433 1479 1434 1480 long start = System.currentTimeMillis(); … … 1450 1496 int order = 6; 1451 1497 1452 Task InstanceTrieTester tester = new TaskInstanceTrieTester(30, 10000, order);1498 TaskTrieTester tester = new TaskTrieTester(30, 10000, order); 1453 1499 1454 1500 long start = System.currentTimeMillis(); … … 1470 1516 int order = 6; 1471 1517 1472 Task InstanceTrieTester tester = new TaskInstanceTrieTester(300, 10000, order);1518 TaskTrieTester tester = new TaskTrieTester(300, 10000, order); 1473 1519 1474 1520 long start = System.currentTimeMillis(); … … 1490 1536 int order = 6; 1491 1537 1492 Task InstanceTrieTester tester = new TaskInstanceTrieTester(1000, 10000, order);1538 TaskTrieTester tester = new TaskTrieTester(1000, 10000, order); 1493 1539 1494 1540 long start = System.currentTimeMillis(); … … 1510 1556 int order = 3; 1511 1557 1512 Task InstanceTrieTester tester = new TaskInstanceTrieTester(1000, 100000, order);1558 TaskTrieTester tester = new TaskTrieTester(1000, 100000, order); 1513 1559 1514 1560 long start = System.currentTimeMillis(); … … 1527 1573 * 1528 1574 */ 1529 private void assertContains(List<List<ITask Instance>> listOfList,1530 List<ITask Instance> containedList)1575 private void assertContains(List<List<ITask>> listOfList, 1576 List<ITask> containedList) 1531 1577 { 1532 1578 boolean found = false; 1533 for (List<ITask Instance> candidate : listOfList) {1579 for (List<ITask> candidate : listOfList) { 1534 1580 if (candidate.size() == containedList.size()) { 1535 1581 found = true; … … 1561 1607 * @author Patrick Harms 1562 1608 */ 1563 private class Task InstanceTrieTester implements TrieProcessor<ITaskInstance> {1609 private class TaskTrieTester implements TrieProcessor<ITask> { 1564 1610 1565 1611 /** 1566 1612 * the symbols used for testing the trie 1567 1613 */ 1568 private Map<Integer, ITask Instance> symbols = new HashMap<Integer, ITaskInstance>();1614 private Map<Integer, ITask> symbols = new HashMap<Integer, ITask>(); 1569 1615 1570 1616 /** … … 1596 1642 * trie calculated the count correctly and if it did not create too many nodes. 1597 1643 */ 1598 public Task InstanceTrieTester(int noOfSymbols, int sequenceLength, int maxOrder) {1644 public TaskTrieTester(int noOfSymbols, int sequenceLength, int maxOrder) { 1599 1645 if (noOfSymbols > 1024) { 1600 1646 throw new IllegalArgumentException("too large number of symbols"); … … 1616 1662 1617 1663 for (int i = 0; i < dummySession.size(); i++) { 1618 this.symbols.put(i, dummySession.get(i) );1664 this.symbols.put(i, dummySession.get(i).getTask()); 1619 1665 } 1620 1666 … … 1675 1721 */ 1676 1722 @Override 1677 public TrieProcessor.Result process(List<ITask Instance> sequence, int count) {1723 public TrieProcessor.Result process(List<ITask> sequence, int count) { 1678 1724 long key = 0; 1679 1725 1680 for (ITask Instancesymbol : sequence) {1726 for (ITask symbol : sequence) { 1681 1727 int symbolIndex = -1; 1682 1728 1683 for (Map.Entry<Integer, ITask Instance> entry : symbols.entrySet()) {1729 for (Map.Entry<Integer, ITask> entry : symbols.entrySet()) { 1684 1730 if (strategy.getTaskComparator().equals(entry.getValue(), symbol)) { 1685 1731 symbolIndex = entry.getKey(); -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskSymbolBucketedMapTest.java
r1294 r1846 34 34 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 35 35 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 36 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance;37 36 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 38 37 import de.ugoe.cs.autoquest.test.DummyGUIElement; … … 63 62 @Test 64 63 public void testSymbolMap_1() { 65 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>66 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));64 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 65 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 67 66 68 67 assertNotNull(symbolMap); … … 73 72 public void testSymbolMap_2() { 74 73 TaskSymbolBucketedMap<String> symbolMap1 = new TaskSymbolBucketedMap<String> 75 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));76 77 ITask Instance taskInstance = createTaskInstance("symbol");78 symbolMap1.addSymbol(task Instance, "value");79 80 SymbolMap<ITask Instance, String> symbolMap2 = new TaskSymbolBucketedMap<String>(symbolMap1);74 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 75 76 ITask task = createTask("symbol"); 77 symbolMap1.addSymbol(task, "value"); 78 79 SymbolMap<ITask, String> symbolMap2 = new TaskSymbolBucketedMap<String>(symbolMap1); 81 80 82 81 assertNotNull(symbolMap2); 83 assertSymbolMapEntries(symbolMap2, new ITask Instance[] { taskInstance},82 assertSymbolMapEntries(symbolMap2, new ITask[] { task }, 84 83 new String[] { "value" }); 85 84 } … … 92 91 @Test 93 92 public void testAddSymbol_1() { 94 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>95 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));96 97 ITask Instance taskInstance = createTaskInstance("symbol");98 symbolMap.addSymbol(task Instance, "value1");93 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 94 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 95 96 ITask task = createTask("symbol"); 97 symbolMap.addSymbol(task, "value1"); 99 98 100 99 assertNotNull(symbolMap); 101 assertSymbolMapEntries(symbolMap, new ITask Instance[] { taskInstance},100 assertSymbolMapEntries(symbolMap, new ITask[] { task }, 102 101 new String[] { "value1" }); 103 102 } … … 105 104 @Test 106 105 public void testAddSymbol_2() { 107 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>108 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));109 110 int entryCount = 2000; 111 112 ITask Instance[] symbols = new ITaskInstance[entryCount];106 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 107 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 108 109 int entryCount = 2000; 110 111 ITask[] symbols = new ITask[entryCount]; 113 112 String[] values = new String[entryCount]; 114 113 115 114 for (int i = 0; i < entryCount; i++) { 116 symbols[i] = createTask Instance("symbol" + i);115 symbols[i] = createTask("symbol" + i); 117 116 symbolMap.addSymbol(symbols[i], "value" + i); 118 117 values[i] = "value" + i; … … 125 124 @Test 126 125 public void testAddSymbol_3() { 127 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>128 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));129 130 int entryCount = 2000; 131 132 ITask Instance[] symbols = new ITaskInstance[entryCount];126 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 127 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 128 129 int entryCount = 2000; 130 131 ITask[] symbols = new ITask[entryCount]; 133 132 String[] values = new String[entryCount]; 134 133 135 134 for (int i = 0; i < entryCount; i++) { 136 symbols[i] = createTask Instance("symbol" + i);135 symbols[i] = createTask("symbol" + i); 137 136 if (i % 7 == 0) { 138 137 values[i] = "value" + i; … … 151 150 @Test(expected = java.lang.IllegalArgumentException.class) 152 151 public void testAddSymbol_4() { 153 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>154 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));152 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 153 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 155 154 156 155 symbolMap.addSymbol(null, null); … … 159 158 @Test 160 159 public void testSize_1() { 161 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>162 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));160 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 161 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 163 162 164 163 assertEquals(0, symbolMap.size()); … … 167 166 @Test 168 167 public void testSize_2() { 169 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>170 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));171 172 symbolMap.addSymbol(createTask Instance("symbol1"), "value1");168 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 169 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 170 171 symbolMap.addSymbol(createTask("symbol1"), "value1"); 173 172 174 173 assertEquals(1, symbolMap.size()); … … 177 176 @Test 178 177 public void testSize_3() { 179 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>180 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));181 182 int entryCount = 2000; 183 184 for (int i = 0; i < entryCount; i++) { 185 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);178 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 179 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 180 181 int entryCount = 2000; 182 183 for (int i = 0; i < entryCount; i++) { 184 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 186 185 } 187 186 … … 191 190 @Test 192 191 public void testSize_4() { 193 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>194 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));195 196 int entryCount = 2000; 197 198 for (int i = 0; i < entryCount; i++) { 199 if (i % 7 == 0) { 200 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);201 } 202 else { 203 symbolMap.addSymbol(createTask Instance("symbol" + i), null);192 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 193 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 194 195 int entryCount = 2000; 196 197 for (int i = 0; i < entryCount; i++) { 198 if (i % 7 == 0) { 199 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 200 } 201 else { 202 symbolMap.addSymbol(createTask("symbol" + i), null); 204 203 } 205 204 } … … 210 209 @Test 211 210 public void testSize_5() { 212 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>213 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));214 215 int entryCount = 2000; 216 217 for (int i = 0; i < entryCount; i++) { 218 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);219 } 220 221 for (int i = 150; i < (entryCount - 150); i++) { 222 symbolMap.removeSymbol(createTask Instance("symbol" + i));211 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 212 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 213 214 int entryCount = 2000; 215 216 for (int i = 0; i < entryCount; i++) { 217 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 218 } 219 220 for (int i = 150; i < (entryCount - 150); i++) { 221 symbolMap.removeSymbol(createTask("symbol" + i)); 223 222 } 224 223 … … 228 227 @Test 229 228 public void testIsEmpty_1() { 230 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>231 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));229 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 230 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 232 231 233 232 assertTrue(symbolMap.isEmpty()); … … 236 235 @Test 237 236 public void testIsEmpty_2() { 238 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>239 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));240 241 symbolMap.addSymbol(createTask Instance("symbol1"), "value1");237 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 238 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 239 240 symbolMap.addSymbol(createTask("symbol1"), "value1"); 242 241 243 242 assertFalse(symbolMap.isEmpty()); … … 246 245 @Test 247 246 public void testIsEmpty_3() { 248 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>249 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));250 251 int entryCount = 2000; 252 253 for (int i = 0; i < entryCount; i++) { 254 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);247 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 248 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 249 250 int entryCount = 2000; 251 252 for (int i = 0; i < entryCount; i++) { 253 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 255 254 } 256 255 … … 260 259 @Test 261 260 public void testIsEmpty_4() { 262 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>263 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));264 265 int entryCount = 2000; 266 267 for (int i = 0; i < entryCount; i++) { 268 if (i % 7 == 0) { 269 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);270 } 271 else { 272 symbolMap.addSymbol(createTask Instance("symbol" + i), null);261 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 262 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 263 264 int entryCount = 2000; 265 266 for (int i = 0; i < entryCount; i++) { 267 if (i % 7 == 0) { 268 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 269 } 270 else { 271 symbolMap.addSymbol(createTask("symbol" + i), null); 273 272 } 274 273 } … … 279 278 @Test 280 279 public void testIsEmpty_5() { 281 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>282 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));283 284 int entryCount = 2000; 285 286 for (int i = 0; i < entryCount; i++) { 287 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);288 } 289 290 for (int i = 150; i < (entryCount - 150); i++) { 291 symbolMap.removeSymbol(createTask Instance("symbol" + i));280 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 281 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 282 283 int entryCount = 2000; 284 285 for (int i = 0; i < entryCount; i++) { 286 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 287 } 288 289 for (int i = 150; i < (entryCount - 150); i++) { 290 symbolMap.removeSymbol(createTask("symbol" + i)); 292 291 } 293 292 … … 297 296 @Test 298 297 public void testContainsSymbol_1() { 299 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>300 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));301 302 assertFalse(symbolMap.containsSymbol(createTask Instance("symbol")));298 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 299 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 300 301 assertFalse(symbolMap.containsSymbol(createTask("symbol"))); 303 302 } 304 303 305 304 @Test 306 305 public void testContainsSymbol_2() { 307 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>308 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));309 310 symbolMap.addSymbol(createTask Instance("symbol1"), "value1");311 312 assertTrue(symbolMap.containsSymbol(createTask Instance("symbol1")));306 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 307 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 308 309 symbolMap.addSymbol(createTask("symbol1"), "value1"); 310 311 assertTrue(symbolMap.containsSymbol(createTask("symbol1"))); 313 312 } 314 313 315 314 @Test 316 315 public void testContainsSymbol_3() { 317 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>318 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));319 320 int entryCount = 2000; 321 322 for (int i = 0; i < entryCount; i++) { 323 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);324 } 325 326 for (int i = 0; i < entryCount; i++) { 327 assertTrue(symbolMap.containsSymbol(createTask Instance("symbol" + i)));316 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 317 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 318 319 int entryCount = 2000; 320 321 for (int i = 0; i < entryCount; i++) { 322 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 323 } 324 325 for (int i = 0; i < entryCount; i++) { 326 assertTrue(symbolMap.containsSymbol(createTask("symbol" + i))); 328 327 } 329 328 } … … 331 330 @Test 332 331 public void testContainsSymbol_4() { 333 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>334 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));335 336 int entryCount = 2000; 337 338 for (int i = 0; i < entryCount; i++) { 339 if (i % 7 == 0) { 340 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);341 } 342 else { 343 symbolMap.addSymbol(createTask Instance("symbol" + i), null);344 } 345 } 346 347 for (int i = 0; i < entryCount; i++) { 348 assertTrue(symbolMap.containsSymbol(createTask Instance("symbol" + i)));332 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 333 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 334 335 int entryCount = 2000; 336 337 for (int i = 0; i < entryCount; i++) { 338 if (i % 7 == 0) { 339 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 340 } 341 else { 342 symbolMap.addSymbol(createTask("symbol" + i), null); 343 } 344 } 345 346 for (int i = 0; i < entryCount; i++) { 347 assertTrue(symbolMap.containsSymbol(createTask("symbol" + i))); 349 348 } 350 349 } … … 352 351 @Test 353 352 public void testContainsSymbol_5() { 354 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>355 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));356 357 int entryCount = 2000; 358 359 for (int i = 0; i < entryCount; i++) { 360 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);361 } 362 363 for (int i = 150; i < (entryCount - 150); i++) { 364 symbolMap.removeSymbol(createTask Instance("symbol" + i));353 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 354 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 355 356 int entryCount = 2000; 357 358 for (int i = 0; i < entryCount; i++) { 359 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 360 } 361 362 for (int i = 150; i < (entryCount - 150); i++) { 363 symbolMap.removeSymbol(createTask("symbol" + i)); 365 364 } 366 365 367 366 for (int i = 0; i < 150; i++) { 368 assertTrue(symbolMap.containsSymbol(createTask Instance("symbol" + i)));369 } 370 371 for (int i = 150; i < (entryCount - 150); i++) { 372 assertFalse(symbolMap.containsSymbol(createTask Instance("symbol" + i)));367 assertTrue(symbolMap.containsSymbol(createTask("symbol" + i))); 368 } 369 370 for (int i = 150; i < (entryCount - 150); i++) { 371 assertFalse(symbolMap.containsSymbol(createTask("symbol" + i))); 373 372 } 374 373 375 374 for (int i = (entryCount - 150); i < entryCount; i++) { 376 assertTrue(symbolMap.containsSymbol(createTask Instance("symbol" + i)));375 assertTrue(symbolMap.containsSymbol(createTask("symbol" + i))); 377 376 } 378 377 } … … 380 379 @Test(expected = java.lang.IllegalArgumentException.class) 381 380 public void testContainsSymbol_6() { 382 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>383 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));381 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 382 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 384 383 385 384 symbolMap.containsSymbol(null); … … 388 387 @Test 389 388 public void testGetValue_1() { 390 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>391 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));392 393 assertNull(symbolMap.getValue(createTask Instance("symbol")));389 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 390 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 391 392 assertNull(symbolMap.getValue(createTask("symbol"))); 394 393 } 395 394 396 395 @Test 397 396 public void testGetValue_2() { 398 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>399 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));400 401 symbolMap.addSymbol(createTask Instance("symbol1"), "value1");402 403 assertNotNull(symbolMap.getValue(createTask Instance("symbol1")));397 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 398 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 399 400 symbolMap.addSymbol(createTask("symbol1"), "value1"); 401 402 assertNotNull(symbolMap.getValue(createTask("symbol1"))); 404 403 } 405 404 406 405 @Test 407 406 public void testGetValue_3() { 408 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>409 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));410 411 symbolMap.addSymbol(createTask Instance("symbol1"), null);412 413 assertNull(symbolMap.getValue(createTask Instance("symbol1")));407 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 408 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 409 410 symbolMap.addSymbol(createTask("symbol1"), null); 411 412 assertNull(symbolMap.getValue(createTask("symbol1"))); 414 413 } 415 414 416 415 @Test 417 416 public void testGetValue_4() { 418 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>419 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));420 421 int entryCount = 2000; 422 423 for (int i = 0; i < entryCount; i++) { 424 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);425 } 426 427 for (int i = 0; i < entryCount; i++) { 428 assertNotNull(symbolMap.getValue(createTask Instance("symbol" + i)));417 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 418 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 419 420 int entryCount = 2000; 421 422 for (int i = 0; i < entryCount; i++) { 423 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 424 } 425 426 for (int i = 0; i < entryCount; i++) { 427 assertNotNull(symbolMap.getValue(createTask("symbol" + i))); 429 428 } 430 429 } … … 432 431 @Test 433 432 public void testGetValue_5() { 434 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>435 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));436 437 int entryCount = 2000; 438 439 for (int i = 0; i < entryCount; i++) { 440 if (i % 7 == 0) { 441 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);442 } 443 else { 444 symbolMap.addSymbol(createTask Instance("symbol" + i), null);445 } 446 } 447 448 for (int i = 0; i < entryCount; i++) { 449 if (i % 7 == 0) { 450 assertNotNull(symbolMap.getValue(createTask Instance("symbol" + i)));451 } 452 else { 453 assertNull(symbolMap.getValue(createTask Instance("symbol" + i)));433 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 434 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 435 436 int entryCount = 2000; 437 438 for (int i = 0; i < entryCount; i++) { 439 if (i % 7 == 0) { 440 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 441 } 442 else { 443 symbolMap.addSymbol(createTask("symbol" + i), null); 444 } 445 } 446 447 for (int i = 0; i < entryCount; i++) { 448 if (i % 7 == 0) { 449 assertNotNull(symbolMap.getValue(createTask("symbol" + i))); 450 } 451 else { 452 assertNull(symbolMap.getValue(createTask("symbol" + i))); 454 453 } 455 454 } … … 458 457 @Test 459 458 public void testGetValue_6() { 460 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>461 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));462 463 int entryCount = 2000; 464 465 for (int i = 0; i < entryCount; i++) { 466 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);467 } 468 469 for (int i = 150; i < (entryCount - 150); i++) { 470 symbolMap.removeSymbol(createTask Instance("symbol" + i));459 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 460 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 461 462 int entryCount = 2000; 463 464 for (int i = 0; i < entryCount; i++) { 465 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 466 } 467 468 for (int i = 150; i < (entryCount - 150); i++) { 469 symbolMap.removeSymbol(createTask("symbol" + i)); 471 470 } 472 471 473 472 for (int i = 0; i < 150; i++) { 474 assertNotNull(symbolMap.getValue(createTask Instance("symbol" + i)));475 } 476 477 for (int i = 150; i < (entryCount - 150); i++) { 478 assertNull(symbolMap.getValue(createTask Instance("symbol" + i)));473 assertNotNull(symbolMap.getValue(createTask("symbol" + i))); 474 } 475 476 for (int i = 150; i < (entryCount - 150); i++) { 477 assertNull(symbolMap.getValue(createTask("symbol" + i))); 479 478 } 480 479 481 480 for (int i = (entryCount - 150); i < entryCount; i++) { 482 assertNotNull(symbolMap.getValue(createTask Instance("symbol" + i)));481 assertNotNull(symbolMap.getValue(createTask("symbol" + i))); 483 482 } 484 483 } … … 486 485 @Test(expected = java.lang.IllegalArgumentException.class) 487 486 public void testGetValue_7() { 488 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>489 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));487 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 488 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 490 489 491 490 symbolMap.getValue(null); … … 494 493 @Test 495 494 public void testRemoveSymbol_1() { 496 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>497 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));498 499 assertNull(symbolMap.removeSymbol(createTask Instance("symbol")));495 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 496 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 497 498 assertNull(symbolMap.removeSymbol(createTask("symbol"))); 500 499 } 501 500 502 501 @Test 503 502 public void testRemoveSymbol_2() { 504 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>505 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));506 507 symbolMap.addSymbol(createTask Instance("symbol1"), "value1");508 509 assertNotNull(symbolMap.removeSymbol(createTask Instance("symbol1")));503 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 504 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 505 506 symbolMap.addSymbol(createTask("symbol1"), "value1"); 507 508 assertNotNull(symbolMap.removeSymbol(createTask("symbol1"))); 510 509 assertEquals(0, symbolMap.size()); 511 510 } … … 513 512 @Test 514 513 public void testRemoveSymbol_3() { 515 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>516 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));517 518 symbolMap.addSymbol(createTask Instance("symbol1"), null);519 520 assertNull(symbolMap.removeSymbol(createTask Instance("symbol1")));514 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 515 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 516 517 symbolMap.addSymbol(createTask("symbol1"), null); 518 519 assertNull(symbolMap.removeSymbol(createTask("symbol1"))); 521 520 assertEquals(0, symbolMap.size()); 522 521 } … … 524 523 @Test 525 524 public void testRemoveSymbol_4() { 526 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>527 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));528 529 int entryCount = 2000; 530 531 for (int i = 0; i < entryCount; i++) { 532 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);533 } 534 535 for (int i = 0; i < entryCount; i++) { 536 assertNotNull(symbolMap.removeSymbol(createTask Instance("symbol" + i)));525 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 526 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 527 528 int entryCount = 2000; 529 530 for (int i = 0; i < entryCount; i++) { 531 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 532 } 533 534 for (int i = 0; i < entryCount; i++) { 535 assertNotNull(symbolMap.removeSymbol(createTask("symbol" + i))); 537 536 } 538 537 … … 542 541 @Test 543 542 public void testRemoveSymbol_5() { 544 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>545 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));546 547 int entryCount = 2000; 548 549 for (int i = 0; i < entryCount; i++) { 550 if (i % 7 == 0) { 551 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);552 } 553 else { 554 symbolMap.addSymbol(createTask Instance("symbol" + i), null);555 } 556 } 557 558 for (int i = 0; i < entryCount; i++) { 559 if (i % 7 == 0) { 560 assertNotNull(symbolMap.removeSymbol(createTask Instance("symbol" + i)));561 } 562 else { 563 assertNull(symbolMap.removeSymbol(createTask Instance("symbol" + i)));543 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 544 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 545 546 int entryCount = 2000; 547 548 for (int i = 0; i < entryCount; i++) { 549 if (i % 7 == 0) { 550 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 551 } 552 else { 553 symbolMap.addSymbol(createTask("symbol" + i), null); 554 } 555 } 556 557 for (int i = 0; i < entryCount; i++) { 558 if (i % 7 == 0) { 559 assertNotNull(symbolMap.removeSymbol(createTask("symbol" + i))); 560 } 561 else { 562 assertNull(symbolMap.removeSymbol(createTask("symbol" + i))); 564 563 } 565 564 } … … 570 569 @Test 571 570 public void testRemoveSymbol_6() { 572 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>573 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));574 575 int entryCount = 2000; 576 577 for (int i = 0; i < entryCount; i++) { 578 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);579 } 580 581 for (int i = 150; i < (entryCount - 150); i++) { 582 symbolMap.removeSymbol(createTask Instance("symbol" + i));571 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 572 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 573 574 int entryCount = 2000; 575 576 for (int i = 0; i < entryCount; i++) { 577 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 578 } 579 580 for (int i = 150; i < (entryCount - 150); i++) { 581 symbolMap.removeSymbol(createTask("symbol" + i)); 583 582 } 584 583 585 584 for (int i = 0; i < 150; i++) { 586 assertNotNull(symbolMap.removeSymbol(createTask Instance("symbol" + i)));587 } 588 589 for (int i = 150; i < (entryCount - 150); i++) { 590 assertNull(symbolMap.removeSymbol(createTask Instance("symbol" + i)));585 assertNotNull(symbolMap.removeSymbol(createTask("symbol" + i))); 586 } 587 588 for (int i = 150; i < (entryCount - 150); i++) { 589 assertNull(symbolMap.removeSymbol(createTask("symbol" + i))); 591 590 } 592 591 593 592 for (int i = (entryCount - 150); i < entryCount; i++) { 594 assertNotNull(symbolMap.removeSymbol(createTask Instance("symbol" + i)));593 assertNotNull(symbolMap.removeSymbol(createTask("symbol" + i))); 595 594 } 596 595 … … 600 599 @Test(expected = java.lang.IllegalArgumentException.class) 601 600 public void testRemoveSymbol_7() { 602 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>603 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));601 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 602 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 604 603 605 604 symbolMap.removeSymbol(null); … … 608 607 @Test 609 608 public void testGetSymbols_1() { 610 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>611 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));609 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 610 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 612 611 613 612 assertNotNull(symbolMap.getSymbols()); … … 617 616 @Test 618 617 public void testGetSymbols_2() { 619 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>620 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));618 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 619 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 621 620 622 ITask Instance task = createTaskInstance("symbol1");621 ITask task = createTask("symbol1"); 623 622 symbolMap.addSymbol(task, "value1"); 624 623 … … 630 629 @Test 631 630 public void testGetSymbols_3() { 632 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>633 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));634 635 ITask Instance task = createTaskInstance("symbol1");631 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 632 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 633 634 ITask task = createTask("symbol1"); 636 635 symbolMap.addSymbol(task, null); 637 636 … … 643 642 @Test 644 643 public void testGetSymbols_4() { 645 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>646 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));647 Set<ITask Instance> expectedSymbols = new HashSet<ITaskInstance>();648 649 int entryCount = 2000; 650 651 for (int i = 0; i < entryCount; i++) { 652 ITask Instance task = createTaskInstance("symbol" + i);644 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 645 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 646 Set<ITask> expectedSymbols = new HashSet<ITask>(); 647 648 int entryCount = 2000; 649 650 for (int i = 0; i < entryCount; i++) { 651 ITask task = createTask("symbol" + i); 653 652 symbolMap.addSymbol(task, "value" + i); 654 653 expectedSymbols.add(task); … … 658 657 assertEquals(entryCount, symbolMap.getSymbols().size()); 659 658 660 Iterator<ITask Instance> iterator = symbolMap.getSymbols().iterator();659 Iterator<ITask> iterator = symbolMap.getSymbols().iterator(); 661 660 for (int i = 0; i < entryCount; i++) { 662 661 assertTrue(iterator.hasNext()); … … 670 669 @Test 671 670 public void testGetSymbols_5() { 672 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>673 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));674 Set<ITask Instance> expectedSymbols = new HashSet<ITaskInstance>();675 676 int entryCount = 2000; 677 678 for (int i = 0; i < entryCount; i++) { 679 ITask Instance task = createTaskInstance("symbol" + i);671 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 672 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 673 Set<ITask> expectedSymbols = new HashSet<ITask>(); 674 675 int entryCount = 2000; 676 677 for (int i = 0; i < entryCount; i++) { 678 ITask task = createTask("symbol" + i); 680 679 681 680 if (i % 7 == 0) { … … 692 691 assertEquals(entryCount, symbolMap.getSymbols().size()); 693 692 694 Iterator<ITask Instance> iterator = symbolMap.getSymbols().iterator();693 Iterator<ITask> iterator = symbolMap.getSymbols().iterator(); 695 694 for (int i = 0; i < entryCount; i++) { 696 695 assertTrue(iterator.hasNext()); … … 704 703 @Test 705 704 public void testGetSymbols_6() { 706 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>707 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));708 List<ITask Instance> expectedSymbols = new ArrayList<ITaskInstance>();709 710 int entryCount = 2000; 711 712 for (int i = 0; i < entryCount; i++) { 713 ITask Instance task = createTaskInstance("symbol" + i);705 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 706 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 707 List<ITask> expectedSymbols = new ArrayList<ITask>(); 708 709 int entryCount = 2000; 710 711 for (int i = 0; i < entryCount; i++) { 712 ITask task = createTask("symbol" + i); 714 713 symbolMap.addSymbol(task, "value" + i); 715 714 expectedSymbols.add(task); … … 723 722 assertEquals(2 * 150, symbolMap.getSymbols().size()); 724 723 725 Iterator<ITask Instance> iterator = symbolMap.getSymbols().iterator();724 Iterator<ITask> iterator = symbolMap.getSymbols().iterator(); 726 725 for (int i = 0; i < 2 * 150; i++) { 727 726 assertTrue(iterator.hasNext()); … … 735 734 @Test 736 735 public void testGetValues_1() { 737 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>738 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));736 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 737 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 739 738 740 739 assertNotNull(symbolMap.getValues()); … … 744 743 @Test 745 744 public void testGetValues_2() { 746 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>747 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));748 749 symbolMap.addSymbol(createTask Instance("symbol1"), "value1");745 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 746 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 747 748 symbolMap.addSymbol(createTask("symbol1"), "value1"); 750 749 751 750 assertNotNull(symbolMap.getValues()); … … 756 755 @Test 757 756 public void testGetValues_3() { 758 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>759 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));760 761 symbolMap.addSymbol(createTask Instance("symbol1"), null);757 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 758 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 759 760 symbolMap.addSymbol(createTask("symbol1"), null); 762 761 763 762 assertNotNull(symbolMap.getValues()); … … 768 767 @Test 769 768 public void testGetValues_4() { 770 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>771 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));769 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 770 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 772 771 Set<String> expectedValues = new HashSet<String>(); 773 772 … … 775 774 776 775 for (int i = 0; i < entryCount; i++) { 777 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);776 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 778 777 expectedValues.add("value" + i); 779 778 } … … 794 793 @Test 795 794 public void testGetValues_5() { 796 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>797 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));795 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 796 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 798 797 Set<String> expectedValues = new HashSet<String>(); 799 798 … … 802 801 for (int i = 0; i < entryCount; i++) { 803 802 if (i % 7 == 0) { 804 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);803 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 805 804 expectedValues.add("value" + i); 806 805 } 807 806 else { 808 symbolMap.addSymbol(createTask Instance("symbol" + i), null);807 symbolMap.addSymbol(createTask("symbol" + i), null); 809 808 expectedValues.add(null); 810 809 } … … 826 825 @Test 827 826 public void testGetValues_6() { 828 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>829 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));827 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 828 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 830 829 Set<String> expectedValues = new HashSet<String>(); 831 830 … … 833 832 834 833 for (int i = 0; i < entryCount; i++) { 835 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);834 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 836 835 expectedValues.add("value" + i); 837 836 } 838 837 839 838 for (int i = 150; i < (entryCount - 150); i++) { 840 symbolMap.removeSymbol(createTask Instance("symbol" + i));839 symbolMap.removeSymbol(createTask("symbol" + i)); 841 840 expectedValues.remove("value" + i); 842 841 } … … 857 856 @Test 858 857 public void testClear_1() { 859 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>860 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));858 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 859 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 861 860 862 861 symbolMap.clear(); … … 866 865 @Test 867 866 public void testClear_2() { 868 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>869 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));870 871 symbolMap.addSymbol(createTask Instance("symbol1"), "value1");867 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 868 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 869 870 symbolMap.addSymbol(createTask("symbol1"), "value1"); 872 871 873 872 symbolMap.clear(); … … 877 876 @Test 878 877 public void testClear_3() { 879 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>880 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));881 882 symbolMap.addSymbol(createTask Instance("symbol1"), null);878 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 879 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 880 881 symbolMap.addSymbol(createTask("symbol1"), null); 883 882 884 883 symbolMap.clear(); … … 888 887 @Test 889 888 public void testClear_4() { 890 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>891 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));892 893 int entryCount = 2000; 894 895 for (int i = 0; i < entryCount; i++) { 896 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);889 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 890 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 891 892 int entryCount = 2000; 893 894 for (int i = 0; i < entryCount; i++) { 895 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 897 896 } 898 897 … … 903 902 @Test 904 903 public void testClear_5() { 905 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>906 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));907 908 int entryCount = 2000; 909 910 for (int i = 0; i < entryCount; i++) { 911 if (i % 7 == 0) { 912 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);913 } 914 else { 915 symbolMap.addSymbol(createTask Instance("symbol" + i), null);904 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 905 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 906 907 int entryCount = 2000; 908 909 for (int i = 0; i < entryCount; i++) { 910 if (i % 7 == 0) { 911 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 912 } 913 else { 914 symbolMap.addSymbol(createTask("symbol" + i), null); 916 915 } 917 916 } … … 923 922 @Test 924 923 public void testClear_6() { 925 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolBucketedMap<String>926 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));927 928 int entryCount = 2000; 929 930 for (int i = 0; i < entryCount; i++) { 931 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);932 } 933 934 for (int i = 150; i < (entryCount - 150); i++) { 935 symbolMap.removeSymbol(createTask Instance("symbol" + i));924 SymbolMap<ITask, String> symbolMap = new TaskSymbolBucketedMap<String> 925 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 926 927 int entryCount = 2000; 928 929 for (int i = 0; i < entryCount; i++) { 930 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 931 } 932 933 for (int i = 150; i < (entryCount - 150); i++) { 934 symbolMap.removeSymbol(createTask("symbol" + i)); 936 935 } 937 936 … … 942 941 @Test 943 942 public void testEquals_1() { 944 SymbolMap<ITask Instance, String> symbolMap1 = new TaskSymbolBucketedMap<String>945 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));946 947 SymbolMap<ITask Instance, String> symbolMap2 = new TaskSymbolBucketedMap<String>948 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));943 SymbolMap<ITask, String> symbolMap1 = new TaskSymbolBucketedMap<String> 944 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 945 946 SymbolMap<ITask, String> symbolMap2 = new TaskSymbolBucketedMap<String> 947 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 949 948 950 949 assertTrue(symbolMap1.equals(symbolMap2)); … … 953 952 @Test 954 953 public void testEquals_2() { 955 SymbolMap<ITask Instance, String> symbolMap1 = new TaskSymbolBucketedMap<String>956 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));957 958 SymbolMap<ITask Instance, String> symbolMap2 = new TaskSymbolBucketedMap<String>959 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));960 961 symbolMap1.addSymbol(createTask Instance("symbol1"), "value1");954 SymbolMap<ITask, String> symbolMap1 = new TaskSymbolBucketedMap<String> 955 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 956 957 SymbolMap<ITask, String> symbolMap2 = new TaskSymbolBucketedMap<String> 958 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 959 960 symbolMap1.addSymbol(createTask("symbol1"), "value1"); 962 961 963 962 assertFalse(symbolMap1.equals(symbolMap2)); … … 966 965 @Test 967 966 public void testEquals_3() { 968 SymbolMap<ITask Instance, String> symbolMap1 = new TaskSymbolBucketedMap<String>969 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));970 971 SymbolMap<ITask Instance, String> symbolMap2 = new TaskSymbolBucketedMap<String>972 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));973 974 ITask Instance task = createTaskInstance("symbol1");967 SymbolMap<ITask, String> symbolMap1 = new TaskSymbolBucketedMap<String> 968 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 969 970 SymbolMap<ITask, String> symbolMap2 = new TaskSymbolBucketedMap<String> 971 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 972 973 ITask task = createTask("symbol1"); 975 974 symbolMap1.addSymbol(task, "value1"); 976 975 symbolMap2.addSymbol(task, "value1"); … … 981 980 @Test 982 981 public void testEquals_4() { 983 SymbolMap<ITask Instance, String> symbolMap1 = new TaskSymbolBucketedMap<String>984 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));982 SymbolMap<ITask, String> symbolMap1 = new TaskSymbolBucketedMap<String> 983 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 985 984 986 SymbolMap<ITask Instance, String> symbolMap2 = new TaskSymbolBucketedMap<String>987 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));985 SymbolMap<ITask, String> symbolMap2 = new TaskSymbolBucketedMap<String> 986 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 988 987 989 988 int entryCount = 1000; 990 989 991 990 for (int i = 0; i < entryCount; i++) { 992 ITask Instance task = createTaskInstance("symbol1");991 ITask task = createTask("symbol1"); 993 992 symbolMap1.addSymbol(task, "value" + i); 994 993 assertFalse(symbolMap1.equals(symbolMap2)); … … 1000 999 @Test 1001 1000 public void testEquals_5() { 1002 SymbolMap<ITask Instance, String> symbolMap1 = new TaskSymbolBucketedMap<String>1003 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));1001 SymbolMap<ITask, String> symbolMap1 = new TaskSymbolBucketedMap<String> 1002 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 1004 1003 1005 SymbolMap<ITask Instance, String> symbolMap2 = new TaskSymbolBucketedMap<String>1006 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));1004 SymbolMap<ITask, String> symbolMap2 = new TaskSymbolBucketedMap<String> 1005 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 1007 1006 1008 1007 int entryCount = 1000; 1009 1008 1010 1009 for (int i = 0; i < entryCount; i++) { 1011 ITask Instance task = createTaskInstance("symbol" + i);1010 ITask task = createTask("symbol" + i); 1012 1011 if (i % 7 == 0) { 1013 1012 symbolMap1.addSymbol(task, "value" + i); … … 1027 1026 @Test 1028 1027 public void testEquals_6() { 1029 SymbolMap<ITask Instance, String> symbolMap1 = new TaskSymbolBucketedMap<String>1030 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));1028 SymbolMap<ITask, String> symbolMap1 = new TaskSymbolBucketedMap<String> 1029 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 1031 1030 1032 SymbolMap<ITask Instance, String> symbolMap2 = new TaskSymbolBucketedMap<String>1033 (new Task InstanceComparator(TaskEquality.SEMANTICALLY_EQUAL));1031 SymbolMap<ITask, String> symbolMap2 = new TaskSymbolBucketedMap<String> 1032 (new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 1034 1033 1035 1034 int entryCount = 1000; 1036 1035 1037 ITask Instance[] taskInstances = new ITaskInstance[entryCount];1038 1039 for (int i = 0; i < entryCount; i++) { 1040 ITask Instance task = createTaskInstance("symbol" + i);1041 task Instances[i] = task;1036 ITask[] tasks = new ITask[entryCount]; 1037 1038 for (int i = 0; i < entryCount; i++) { 1039 ITask task = createTask("symbol" + i); 1040 tasks[i] = task; 1042 1041 symbolMap1.addSymbol(task, "value" + i); 1043 1042 assertFalse(symbolMap1.equals(symbolMap2)); … … 1047 1046 1048 1047 for (int i = 150; i < (entryCount - 150); i++) { 1049 symbolMap1.removeSymbol(task Instances[i]);1048 symbolMap1.removeSymbol(tasks[i]); 1050 1049 assertFalse(symbolMap1.equals(symbolMap2)); 1051 symbolMap2.removeSymbol(task Instances[i]);1050 symbolMap2.removeSymbol(tasks[i]); 1052 1051 assertTrue(symbolMap1.equals(symbolMap2)); 1053 1052 } … … 1057 1056 * 1058 1057 */ 1059 private ITask Instance createTaskInstance(String id) {1058 private ITask createTask(String id) { 1060 1059 ITask task = tasks.get(id); 1061 1060 Event event = null; … … 1071 1070 } 1072 1071 1073 return taskFactory.createNewTaskInstance((IEventTask) task, event); 1074 } 1075 1076 private void assertSymbolMapEntries(SymbolMap<ITaskInstance, String> symbolMap, 1077 ITaskInstance[] symbols, 1078 String[] values) 1072 taskFactory.createNewTaskInstance((IEventTask) task, event); 1073 1074 return task; 1075 } 1076 1077 private void assertSymbolMapEntries(SymbolMap<ITask, String> symbolMap, 1078 ITask[] symbols, 1079 String[] values) 1079 1080 { 1080 1081 assertEquals(symbols.length, symbolMap.size()); -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskSymbolIdentityMapTest.java
r1294 r1846 33 33 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 34 34 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 35 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance;36 35 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 37 36 import de.ugoe.cs.autoquest.test.DummyGUIElement; … … 62 61 @Test 63 62 public void testSymbolMap_1() { 64 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();63 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 65 64 66 65 assertNotNull(symbolMap); … … 72 71 TaskSymbolIdentityMap<String> symbolMap1 = new TaskSymbolIdentityMap<String>(); 73 72 74 ITask Instance taskInstance = createTaskInstance("symbol");75 symbolMap1.addSymbol(task Instance, "value");76 77 SymbolMap<ITask Instance, String> symbolMap2 = new TaskSymbolIdentityMap<String>(symbolMap1);73 ITask task = createTask("symbol"); 74 symbolMap1.addSymbol(task, "value"); 75 76 SymbolMap<ITask, String> symbolMap2 = new TaskSymbolIdentityMap<String>(symbolMap1); 78 77 79 78 assertNotNull(symbolMap2); 80 assertSymbolMapEntries(symbolMap2, new ITask Instance[] { taskInstance},79 assertSymbolMapEntries(symbolMap2, new ITask[] { task }, 81 80 new String[] { "value" }); 82 81 } … … 89 88 @Test 90 89 public void testAddSymbol_1() { 91 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();92 93 ITask Instance taskInstance = createTaskInstance("symbol");94 symbolMap.addSymbol(task Instance, "value1");90 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 91 92 ITask task = createTask("symbol"); 93 symbolMap.addSymbol(task, "value1"); 95 94 96 95 assertNotNull(symbolMap); 97 assertSymbolMapEntries(symbolMap, new ITask Instance[] { taskInstance},96 assertSymbolMapEntries(symbolMap, new ITask[] { task }, 98 97 new String[] { "value1" }); 99 98 } … … 101 100 @Test 102 101 public void testAddSymbol_2() { 103 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();104 105 int entryCount = 2000; 106 107 ITask Instance[] symbols = new ITaskInstance[entryCount];102 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 103 104 int entryCount = 2000; 105 106 ITask[] symbols = new ITask[entryCount]; 108 107 String[] values = new String[entryCount]; 109 108 110 109 for (int i = 0; i < entryCount; i++) { 111 symbols[i] = createTask Instance("symbol" + i);110 symbols[i] = createTask("symbol" + i); 112 111 symbolMap.addSymbol(symbols[i], "value" + i); 113 112 values[i] = "value" + i; … … 120 119 @Test 121 120 public void testAddSymbol_3() { 122 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();123 124 int entryCount = 2000; 125 126 ITask Instance[] symbols = new ITaskInstance[entryCount];121 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 122 123 int entryCount = 2000; 124 125 ITask[] symbols = new ITask[entryCount]; 127 126 String[] values = new String[entryCount]; 128 127 129 128 for (int i = 0; i < entryCount; i++) { 130 symbols[i] = createTask Instance("symbol" + i);129 symbols[i] = createTask("symbol" + i); 131 130 if (i % 7 == 0) { 132 131 values[i] = "value" + i; … … 145 144 @Test(expected = java.lang.IllegalArgumentException.class) 146 145 public void testAddSymbol_4() { 147 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();146 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 148 147 149 148 symbolMap.addSymbol(null, null); … … 152 151 @Test 153 152 public void testSize_1() { 154 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();153 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 155 154 156 155 assertEquals(0, symbolMap.size()); … … 159 158 @Test 160 159 public void testSize_2() { 161 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();162 163 symbolMap.addSymbol(createTask Instance("symbol1"), "value1");160 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 161 162 symbolMap.addSymbol(createTask("symbol1"), "value1"); 164 163 165 164 assertEquals(1, symbolMap.size()); … … 168 167 @Test 169 168 public void testSize_3() { 170 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();171 172 int entryCount = 2000; 173 174 for (int i = 0; i < entryCount; i++) { 175 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);169 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 170 171 int entryCount = 2000; 172 173 for (int i = 0; i < entryCount; i++) { 174 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 176 175 } 177 176 … … 181 180 @Test 182 181 public void testSize_4() { 183 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();184 185 int entryCount = 2000; 186 187 for (int i = 0; i < entryCount; i++) { 188 if (i % 7 == 0) { 189 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);190 } 191 else { 192 symbolMap.addSymbol(createTask Instance("symbol" + i), null);182 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 183 184 int entryCount = 2000; 185 186 for (int i = 0; i < entryCount; i++) { 187 if (i % 7 == 0) { 188 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 189 } 190 else { 191 symbolMap.addSymbol(createTask("symbol" + i), null); 193 192 } 194 193 } … … 199 198 @Test 200 199 public void testSize_5() { 201 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();202 203 int entryCount = 2000; 204 205 for (int i = 0; i < entryCount; i++) { 206 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);207 } 208 209 for (int i = 150; i < (entryCount - 150); i++) { 210 symbolMap.removeSymbol(createTask Instance("symbol" + i));200 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 201 202 int entryCount = 2000; 203 204 for (int i = 0; i < entryCount; i++) { 205 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 206 } 207 208 for (int i = 150; i < (entryCount - 150); i++) { 209 symbolMap.removeSymbol(createTask("symbol" + i)); 211 210 } 212 211 … … 216 215 @Test 217 216 public void testIsEmpty_1() { 218 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();217 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 219 218 220 219 assertTrue(symbolMap.isEmpty()); … … 223 222 @Test 224 223 public void testIsEmpty_2() { 225 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();226 227 symbolMap.addSymbol(createTask Instance("symbol1"), "value1");224 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 225 226 symbolMap.addSymbol(createTask("symbol1"), "value1"); 228 227 229 228 assertFalse(symbolMap.isEmpty()); … … 232 231 @Test 233 232 public void testIsEmpty_3() { 234 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();235 236 int entryCount = 2000; 237 238 for (int i = 0; i < entryCount; i++) { 239 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);233 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 234 235 int entryCount = 2000; 236 237 for (int i = 0; i < entryCount; i++) { 238 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 240 239 } 241 240 … … 245 244 @Test 246 245 public void testIsEmpty_4() { 247 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();248 249 int entryCount = 2000; 250 251 for (int i = 0; i < entryCount; i++) { 252 if (i % 7 == 0) { 253 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);254 } 255 else { 256 symbolMap.addSymbol(createTask Instance("symbol" + i), null);246 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 247 248 int entryCount = 2000; 249 250 for (int i = 0; i < entryCount; i++) { 251 if (i % 7 == 0) { 252 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 253 } 254 else { 255 symbolMap.addSymbol(createTask("symbol" + i), null); 257 256 } 258 257 } … … 263 262 @Test 264 263 public void testIsEmpty_5() { 265 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();266 267 int entryCount = 2000; 268 269 for (int i = 0; i < entryCount; i++) { 270 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);271 } 272 273 for (int i = 150; i < (entryCount - 150); i++) { 274 symbolMap.removeSymbol(createTask Instance("symbol" + i));264 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 265 266 int entryCount = 2000; 267 268 for (int i = 0; i < entryCount; i++) { 269 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 270 } 271 272 for (int i = 150; i < (entryCount - 150); i++) { 273 symbolMap.removeSymbol(createTask("symbol" + i)); 275 274 } 276 275 … … 280 279 @Test 281 280 public void testContainsSymbol_1() { 282 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();283 284 assertFalse(symbolMap.containsSymbol(createTask Instance("symbol")));281 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 282 283 assertFalse(symbolMap.containsSymbol(createTask("symbol"))); 285 284 } 286 285 287 286 @Test 288 287 public void testContainsSymbol_2() { 289 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();290 291 symbolMap.addSymbol(createTask Instance("symbol1"), "value1");292 293 assertTrue(symbolMap.containsSymbol(createTask Instance("symbol1")));288 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 289 290 symbolMap.addSymbol(createTask("symbol1"), "value1"); 291 292 assertTrue(symbolMap.containsSymbol(createTask("symbol1"))); 294 293 } 295 294 296 295 @Test 297 296 public void testContainsSymbol_3() { 298 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();299 300 int entryCount = 2000; 301 302 for (int i = 0; i < entryCount; i++) { 303 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);304 } 305 306 for (int i = 0; i < entryCount; i++) { 307 assertTrue(symbolMap.containsSymbol(createTask Instance("symbol" + i)));297 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 298 299 int entryCount = 2000; 300 301 for (int i = 0; i < entryCount; i++) { 302 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 303 } 304 305 for (int i = 0; i < entryCount; i++) { 306 assertTrue(symbolMap.containsSymbol(createTask("symbol" + i))); 308 307 } 309 308 } … … 311 310 @Test 312 311 public void testContainsSymbol_4() { 313 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();314 315 int entryCount = 2000; 316 317 for (int i = 0; i < entryCount; i++) { 318 if (i % 7 == 0) { 319 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);320 } 321 else { 322 symbolMap.addSymbol(createTask Instance("symbol" + i), null);323 } 324 } 325 326 for (int i = 0; i < entryCount; i++) { 327 assertTrue(symbolMap.containsSymbol(createTask Instance("symbol" + i)));312 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 313 314 int entryCount = 2000; 315 316 for (int i = 0; i < entryCount; i++) { 317 if (i % 7 == 0) { 318 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 319 } 320 else { 321 symbolMap.addSymbol(createTask("symbol" + i), null); 322 } 323 } 324 325 for (int i = 0; i < entryCount; i++) { 326 assertTrue(symbolMap.containsSymbol(createTask("symbol" + i))); 328 327 } 329 328 } … … 331 330 @Test 332 331 public void testContainsSymbol_5() { 333 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();334 335 int entryCount = 2000; 336 337 for (int i = 0; i < entryCount; i++) { 338 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);339 } 340 341 for (int i = 150; i < (entryCount - 150); i++) { 342 symbolMap.removeSymbol(createTask Instance("symbol" + i));332 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 333 334 int entryCount = 2000; 335 336 for (int i = 0; i < entryCount; i++) { 337 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 338 } 339 340 for (int i = 150; i < (entryCount - 150); i++) { 341 symbolMap.removeSymbol(createTask("symbol" + i)); 343 342 } 344 343 345 344 for (int i = 0; i < 150; i++) { 346 assertTrue(symbolMap.containsSymbol(createTask Instance("symbol" + i)));347 } 348 349 for (int i = 150; i < (entryCount - 150); i++) { 350 assertFalse(symbolMap.containsSymbol(createTask Instance("symbol" + i)));345 assertTrue(symbolMap.containsSymbol(createTask("symbol" + i))); 346 } 347 348 for (int i = 150; i < (entryCount - 150); i++) { 349 assertFalse(symbolMap.containsSymbol(createTask("symbol" + i))); 351 350 } 352 351 353 352 for (int i = (entryCount - 150); i < entryCount; i++) { 354 assertTrue(symbolMap.containsSymbol(createTask Instance("symbol" + i)));353 assertTrue(symbolMap.containsSymbol(createTask("symbol" + i))); 355 354 } 356 355 } … … 358 357 @Test(expected = java.lang.IllegalArgumentException.class) 359 358 public void testContainsSymbol_6() { 360 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();359 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 361 360 362 361 symbolMap.containsSymbol(null); … … 365 364 @Test 366 365 public void testGetValue_1() { 367 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();368 369 assertNull(symbolMap.getValue(createTask Instance("symbol")));366 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 367 368 assertNull(symbolMap.getValue(createTask("symbol"))); 370 369 } 371 370 372 371 @Test 373 372 public void testGetValue_2() { 374 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();375 376 symbolMap.addSymbol(createTask Instance("symbol1"), "value1");377 378 assertNotNull(symbolMap.getValue(createTask Instance("symbol1")));373 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 374 375 symbolMap.addSymbol(createTask("symbol1"), "value1"); 376 377 assertNotNull(symbolMap.getValue(createTask("symbol1"))); 379 378 } 380 379 381 380 @Test 382 381 public void testGetValue_3() { 383 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();384 385 symbolMap.addSymbol(createTask Instance("symbol1"), null);386 387 assertNull(symbolMap.getValue(createTask Instance("symbol1")));382 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 383 384 symbolMap.addSymbol(createTask("symbol1"), null); 385 386 assertNull(symbolMap.getValue(createTask("symbol1"))); 388 387 } 389 388 390 389 @Test 391 390 public void testGetValue_4() { 392 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();393 394 int entryCount = 2000; 395 396 for (int i = 0; i < entryCount; i++) { 397 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);398 } 399 400 for (int i = 0; i < entryCount; i++) { 401 assertNotNull(symbolMap.getValue(createTask Instance("symbol" + i)));391 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 392 393 int entryCount = 2000; 394 395 for (int i = 0; i < entryCount; i++) { 396 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 397 } 398 399 for (int i = 0; i < entryCount; i++) { 400 assertNotNull(symbolMap.getValue(createTask("symbol" + i))); 402 401 } 403 402 } … … 405 404 @Test 406 405 public void testGetValue_5() { 407 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();408 409 int entryCount = 2000; 410 411 for (int i = 0; i < entryCount; i++) { 412 if (i % 7 == 0) { 413 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);414 } 415 else { 416 symbolMap.addSymbol(createTask Instance("symbol" + i), null);417 } 418 } 419 420 for (int i = 0; i < entryCount; i++) { 421 if (i % 7 == 0) { 422 assertNotNull(symbolMap.getValue(createTask Instance("symbol" + i)));423 } 424 else { 425 assertNull(symbolMap.getValue(createTask Instance("symbol" + i)));406 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 407 408 int entryCount = 2000; 409 410 for (int i = 0; i < entryCount; i++) { 411 if (i % 7 == 0) { 412 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 413 } 414 else { 415 symbolMap.addSymbol(createTask("symbol" + i), null); 416 } 417 } 418 419 for (int i = 0; i < entryCount; i++) { 420 if (i % 7 == 0) { 421 assertNotNull(symbolMap.getValue(createTask("symbol" + i))); 422 } 423 else { 424 assertNull(symbolMap.getValue(createTask("symbol" + i))); 426 425 } 427 426 } … … 430 429 @Test 431 430 public void testGetValue_6() { 432 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();433 434 int entryCount = 2000; 435 436 for (int i = 0; i < entryCount; i++) { 437 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);438 } 439 440 for (int i = 150; i < (entryCount - 150); i++) { 441 symbolMap.removeSymbol(createTask Instance("symbol" + i));431 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 432 433 int entryCount = 2000; 434 435 for (int i = 0; i < entryCount; i++) { 436 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 437 } 438 439 for (int i = 150; i < (entryCount - 150); i++) { 440 symbolMap.removeSymbol(createTask("symbol" + i)); 442 441 } 443 442 444 443 for (int i = 0; i < 150; i++) { 445 assertNotNull(symbolMap.getValue(createTask Instance("symbol" + i)));446 } 447 448 for (int i = 150; i < (entryCount - 150); i++) { 449 assertNull(symbolMap.getValue(createTask Instance("symbol" + i)));444 assertNotNull(symbolMap.getValue(createTask("symbol" + i))); 445 } 446 447 for (int i = 150; i < (entryCount - 150); i++) { 448 assertNull(symbolMap.getValue(createTask("symbol" + i))); 450 449 } 451 450 452 451 for (int i = (entryCount - 150); i < entryCount; i++) { 453 assertNotNull(symbolMap.getValue(createTask Instance("symbol" + i)));452 assertNotNull(symbolMap.getValue(createTask("symbol" + i))); 454 453 } 455 454 } … … 457 456 @Test(expected = java.lang.IllegalArgumentException.class) 458 457 public void testGetValue_7() { 459 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();458 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 460 459 461 460 symbolMap.getValue(null); … … 464 463 @Test 465 464 public void testRemoveSymbol_1() { 466 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();467 468 assertNull(symbolMap.removeSymbol(createTask Instance("symbol")));465 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 466 467 assertNull(symbolMap.removeSymbol(createTask("symbol"))); 469 468 } 470 469 471 470 @Test 472 471 public void testRemoveSymbol_2() { 473 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();474 475 symbolMap.addSymbol(createTask Instance("symbol1"), "value1");476 477 assertNotNull(symbolMap.removeSymbol(createTask Instance("symbol1")));472 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 473 474 symbolMap.addSymbol(createTask("symbol1"), "value1"); 475 476 assertNotNull(symbolMap.removeSymbol(createTask("symbol1"))); 478 477 assertEquals(0, symbolMap.size()); 479 478 } … … 481 480 @Test 482 481 public void testRemoveSymbol_3() { 483 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();484 485 symbolMap.addSymbol(createTask Instance("symbol1"), null);486 487 assertNull(symbolMap.removeSymbol(createTask Instance("symbol1")));482 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 483 484 symbolMap.addSymbol(createTask("symbol1"), null); 485 486 assertNull(symbolMap.removeSymbol(createTask("symbol1"))); 488 487 assertEquals(0, symbolMap.size()); 489 488 } … … 491 490 @Test 492 491 public void testRemoveSymbol_4() { 493 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();494 495 int entryCount = 2000; 496 497 for (int i = 0; i < entryCount; i++) { 498 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);499 } 500 501 for (int i = 0; i < entryCount; i++) { 502 assertNotNull(symbolMap.removeSymbol(createTask Instance("symbol" + i)));492 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 493 494 int entryCount = 2000; 495 496 for (int i = 0; i < entryCount; i++) { 497 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 498 } 499 500 for (int i = 0; i < entryCount; i++) { 501 assertNotNull(symbolMap.removeSymbol(createTask("symbol" + i))); 503 502 } 504 503 … … 508 507 @Test 509 508 public void testRemoveSymbol_5() { 510 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();511 512 int entryCount = 2000; 513 514 for (int i = 0; i < entryCount; i++) { 515 if (i % 7 == 0) { 516 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);517 } 518 else { 519 symbolMap.addSymbol(createTask Instance("symbol" + i), null);520 } 521 } 522 523 for (int i = 0; i < entryCount; i++) { 524 if (i % 7 == 0) { 525 assertNotNull(symbolMap.removeSymbol(createTask Instance("symbol" + i)));526 } 527 else { 528 assertNull(symbolMap.removeSymbol(createTask Instance("symbol" + i)));509 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 510 511 int entryCount = 2000; 512 513 for (int i = 0; i < entryCount; i++) { 514 if (i % 7 == 0) { 515 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 516 } 517 else { 518 symbolMap.addSymbol(createTask("symbol" + i), null); 519 } 520 } 521 522 for (int i = 0; i < entryCount; i++) { 523 if (i % 7 == 0) { 524 assertNotNull(symbolMap.removeSymbol(createTask("symbol" + i))); 525 } 526 else { 527 assertNull(symbolMap.removeSymbol(createTask("symbol" + i))); 529 528 } 530 529 } … … 535 534 @Test 536 535 public void testRemoveSymbol_6() { 537 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();538 539 int entryCount = 2000; 540 541 for (int i = 0; i < entryCount; i++) { 542 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);543 } 544 545 for (int i = 150; i < (entryCount - 150); i++) { 546 symbolMap.removeSymbol(createTask Instance("symbol" + i));536 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 537 538 int entryCount = 2000; 539 540 for (int i = 0; i < entryCount; i++) { 541 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 542 } 543 544 for (int i = 150; i < (entryCount - 150); i++) { 545 symbolMap.removeSymbol(createTask("symbol" + i)); 547 546 } 548 547 549 548 for (int i = 0; i < 150; i++) { 550 assertNotNull(symbolMap.removeSymbol(createTask Instance("symbol" + i)));551 } 552 553 for (int i = 150; i < (entryCount - 150); i++) { 554 assertNull(symbolMap.removeSymbol(createTask Instance("symbol" + i)));549 assertNotNull(symbolMap.removeSymbol(createTask("symbol" + i))); 550 } 551 552 for (int i = 150; i < (entryCount - 150); i++) { 553 assertNull(symbolMap.removeSymbol(createTask("symbol" + i))); 555 554 } 556 555 557 556 for (int i = (entryCount - 150); i < entryCount; i++) { 558 assertNotNull(symbolMap.removeSymbol(createTask Instance("symbol" + i)));557 assertNotNull(symbolMap.removeSymbol(createTask("symbol" + i))); 559 558 } 560 559 … … 564 563 @Test(expected = java.lang.IllegalArgumentException.class) 565 564 public void testRemoveSymbol_7() { 566 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();565 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 567 566 568 567 symbolMap.removeSymbol(null); … … 571 570 @Test 572 571 public void testGetSymbols_1() { 573 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();572 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 574 573 575 574 assertNotNull(symbolMap.getSymbols()); … … 579 578 @Test 580 579 public void testGetSymbols_2() { 581 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();580 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 582 581 583 ITask Instance task = createTaskInstance("symbol1");582 ITask task = createTask("symbol1"); 584 583 symbolMap.addSymbol(task, "value1"); 585 584 … … 591 590 @Test 592 591 public void testGetSymbols_3() { 593 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();594 595 ITask Instance task = createTaskInstance("symbol1");592 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 593 594 ITask task = createTask("symbol1"); 596 595 symbolMap.addSymbol(task, null); 597 596 … … 603 602 @Test 604 603 public void testGetSymbols_4() { 605 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();606 Set<ITask Instance> expectedSymbols = new HashSet<ITaskInstance>();607 608 int entryCount = 2000; 609 610 for (int i = 0; i < entryCount; i++) { 611 ITask Instance task = createTaskInstance("symbol" + i);604 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 605 Set<ITask> expectedSymbols = new HashSet<ITask>(); 606 607 int entryCount = 2000; 608 609 for (int i = 0; i < entryCount; i++) { 610 ITask task = createTask("symbol" + i); 612 611 symbolMap.addSymbol(task, "value" + i); 613 612 expectedSymbols.add(task); … … 617 616 assertEquals(entryCount, symbolMap.getSymbols().size()); 618 617 619 Iterator<ITask Instance> iterator = symbolMap.getSymbols().iterator();618 Iterator<ITask> iterator = symbolMap.getSymbols().iterator(); 620 619 for (int i = 0; i < entryCount; i++) { 621 620 assertTrue(iterator.hasNext()); … … 629 628 @Test 630 629 public void testGetSymbols_5() { 631 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();632 Set<ITask Instance> expectedSymbols = new HashSet<ITaskInstance>();633 634 int entryCount = 2000; 635 636 for (int i = 0; i < entryCount; i++) { 637 ITask Instance task = createTaskInstance("symbol" + i);630 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 631 Set<ITask> expectedSymbols = new HashSet<ITask>(); 632 633 int entryCount = 2000; 634 635 for (int i = 0; i < entryCount; i++) { 636 ITask task = createTask("symbol" + i); 638 637 639 638 if (i % 7 == 0) { … … 650 649 assertEquals(entryCount, symbolMap.getSymbols().size()); 651 650 652 Iterator<ITask Instance> iterator = symbolMap.getSymbols().iterator();651 Iterator<ITask> iterator = symbolMap.getSymbols().iterator(); 653 652 for (int i = 0; i < entryCount; i++) { 654 653 assertTrue(iterator.hasNext()); … … 662 661 @Test 663 662 public void testGetSymbols_6() { 664 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();665 List<ITask Instance> expectedSymbols = new ArrayList<ITaskInstance>();666 667 int entryCount = 2000; 668 669 for (int i = 0; i < entryCount; i++) { 670 ITask Instance task = createTaskInstance("symbol" + i);663 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 664 List<ITask> expectedSymbols = new ArrayList<ITask>(); 665 666 int entryCount = 2000; 667 668 for (int i = 0; i < entryCount; i++) { 669 ITask task = createTask("symbol" + i); 671 670 symbolMap.addSymbol(task, "value" + i); 672 671 expectedSymbols.add(task); … … 680 679 assertEquals(2 * 150, symbolMap.getSymbols().size()); 681 680 682 Iterator<ITask Instance> iterator = symbolMap.getSymbols().iterator();681 Iterator<ITask> iterator = symbolMap.getSymbols().iterator(); 683 682 for (int i = 0; i < 2 * 150; i++) { 684 683 assertTrue(iterator.hasNext()); … … 692 691 @Test 693 692 public void testGetValues_1() { 694 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();693 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 695 694 696 695 assertNotNull(symbolMap.getValues()); … … 700 699 @Test 701 700 public void testGetValues_2() { 702 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();703 704 symbolMap.addSymbol(createTask Instance("symbol1"), "value1");701 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 702 703 symbolMap.addSymbol(createTask("symbol1"), "value1"); 705 704 706 705 assertNotNull(symbolMap.getValues()); … … 711 710 @Test 712 711 public void testGetValues_3() { 713 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();714 715 symbolMap.addSymbol(createTask Instance("symbol1"), null);712 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 713 714 symbolMap.addSymbol(createTask("symbol1"), null); 716 715 717 716 assertNotNull(symbolMap.getValues()); … … 722 721 @Test 723 722 public void testGetValues_4() { 724 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();723 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 725 724 Set<String> expectedValues = new HashSet<String>(); 726 725 … … 728 727 729 728 for (int i = 0; i < entryCount; i++) { 730 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);729 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 731 730 expectedValues.add("value" + i); 732 731 } … … 747 746 @Test 748 747 public void testGetValues_5() { 749 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();748 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 750 749 Set<String> expectedValues = new HashSet<String>(); 751 750 … … 754 753 for (int i = 0; i < entryCount; i++) { 755 754 if (i % 7 == 0) { 756 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);755 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 757 756 expectedValues.add("value" + i); 758 757 } 759 758 else { 760 symbolMap.addSymbol(createTask Instance("symbol" + i), null);759 symbolMap.addSymbol(createTask("symbol" + i), null); 761 760 expectedValues.add(null); 762 761 } … … 778 777 @Test 779 778 public void testGetValues_6() { 780 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();779 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 781 780 Set<String> expectedValues = new HashSet<String>(); 782 781 … … 784 783 785 784 for (int i = 0; i < entryCount; i++) { 786 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);785 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 787 786 expectedValues.add("value" + i); 788 787 } 789 788 790 789 for (int i = 150; i < (entryCount - 150); i++) { 791 symbolMap.removeSymbol(createTask Instance("symbol" + i));790 symbolMap.removeSymbol(createTask("symbol" + i)); 792 791 expectedValues.remove("value" + i); 793 792 } … … 808 807 @Test 809 808 public void testClear_1() { 810 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();809 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 811 810 812 811 symbolMap.clear(); … … 816 815 @Test 817 816 public void testClear_2() { 818 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();819 820 symbolMap.addSymbol(createTask Instance("symbol1"), "value1");817 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 818 819 symbolMap.addSymbol(createTask("symbol1"), "value1"); 821 820 822 821 symbolMap.clear(); … … 826 825 @Test 827 826 public void testClear_3() { 828 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();829 830 symbolMap.addSymbol(createTask Instance("symbol1"), null);827 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 828 829 symbolMap.addSymbol(createTask("symbol1"), null); 831 830 832 831 symbolMap.clear(); … … 836 835 @Test 837 836 public void testClear_4() { 838 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();839 840 int entryCount = 2000; 841 842 for (int i = 0; i < entryCount; i++) { 843 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);837 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 838 839 int entryCount = 2000; 840 841 for (int i = 0; i < entryCount; i++) { 842 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 844 843 } 845 844 … … 850 849 @Test 851 850 public void testClear_5() { 852 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();853 854 int entryCount = 2000; 855 856 for (int i = 0; i < entryCount; i++) { 857 if (i % 7 == 0) { 858 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);859 } 860 else { 861 symbolMap.addSymbol(createTask Instance("symbol" + i), null);851 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 852 853 int entryCount = 2000; 854 855 for (int i = 0; i < entryCount; i++) { 856 if (i % 7 == 0) { 857 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 858 } 859 else { 860 symbolMap.addSymbol(createTask("symbol" + i), null); 862 861 } 863 862 } … … 869 868 @Test 870 869 public void testClear_6() { 871 SymbolMap<ITask Instance, String> symbolMap = new TaskSymbolIdentityMap<String>();872 873 int entryCount = 2000; 874 875 for (int i = 0; i < entryCount; i++) { 876 symbolMap.addSymbol(createTask Instance("symbol" + i), "value" + i);877 } 878 879 for (int i = 150; i < (entryCount - 150); i++) { 880 symbolMap.removeSymbol(createTask Instance("symbol" + i));870 SymbolMap<ITask, String> symbolMap = new TaskSymbolIdentityMap<String>(); 871 872 int entryCount = 2000; 873 874 for (int i = 0; i < entryCount; i++) { 875 symbolMap.addSymbol(createTask("symbol" + i), "value" + i); 876 } 877 878 for (int i = 150; i < (entryCount - 150); i++) { 879 symbolMap.removeSymbol(createTask("symbol" + i)); 881 880 } 882 881 … … 887 886 @Test 888 887 public void testEquals_1() { 889 SymbolMap<ITask Instance, String> symbolMap1 = new TaskSymbolIdentityMap<String>();890 891 SymbolMap<ITask Instance, String> symbolMap2 = new TaskSymbolIdentityMap<String>();888 SymbolMap<ITask, String> symbolMap1 = new TaskSymbolIdentityMap<String>(); 889 890 SymbolMap<ITask, String> symbolMap2 = new TaskSymbolIdentityMap<String>(); 892 891 893 892 assertTrue(symbolMap1.equals(symbolMap2)); … … 896 895 @Test 897 896 public void testEquals_2() { 898 SymbolMap<ITask Instance, String> symbolMap1 = new TaskSymbolIdentityMap<String>();899 900 SymbolMap<ITask Instance, String> symbolMap2 = new TaskSymbolIdentityMap<String>();901 902 symbolMap1.addSymbol(createTask Instance("symbol1"), "value1");897 SymbolMap<ITask, String> symbolMap1 = new TaskSymbolIdentityMap<String>(); 898 899 SymbolMap<ITask, String> symbolMap2 = new TaskSymbolIdentityMap<String>(); 900 901 symbolMap1.addSymbol(createTask("symbol1"), "value1"); 903 902 904 903 assertFalse(symbolMap1.equals(symbolMap2)); … … 907 906 @Test 908 907 public void testEquals_3() { 909 SymbolMap<ITask Instance, String> symbolMap1 = new TaskSymbolIdentityMap<String>();910 911 SymbolMap<ITask Instance, String> symbolMap2 = new TaskSymbolIdentityMap<String>();912 913 ITask Instance task = createTaskInstance("symbol1");908 SymbolMap<ITask, String> symbolMap1 = new TaskSymbolIdentityMap<String>(); 909 910 SymbolMap<ITask, String> symbolMap2 = new TaskSymbolIdentityMap<String>(); 911 912 ITask task = createTask("symbol1"); 914 913 symbolMap1.addSymbol(task, "value1"); 915 914 symbolMap2.addSymbol(task, "value1"); … … 920 919 @Test 921 920 public void testEquals_4() { 922 SymbolMap<ITask Instance, String> symbolMap1 = new TaskSymbolIdentityMap<String>();921 SymbolMap<ITask, String> symbolMap1 = new TaskSymbolIdentityMap<String>(); 923 922 924 SymbolMap<ITask Instance, String> symbolMap2 = new TaskSymbolIdentityMap<String>();923 SymbolMap<ITask, String> symbolMap2 = new TaskSymbolIdentityMap<String>(); 925 924 926 925 int entryCount = 1000; 927 926 928 927 for (int i = 0; i < entryCount; i++) { 929 ITask Instance task = createTaskInstance("symbol1");928 ITask task = createTask("symbol1"); 930 929 symbolMap1.addSymbol(task, "value" + i); 931 930 assertFalse(symbolMap1.equals(symbolMap2)); … … 937 936 @Test 938 937 public void testEquals_5() { 939 SymbolMap<ITask Instance, String> symbolMap1 = new TaskSymbolIdentityMap<String>();938 SymbolMap<ITask, String> symbolMap1 = new TaskSymbolIdentityMap<String>(); 940 939 941 SymbolMap<ITask Instance, String> symbolMap2 = new TaskSymbolIdentityMap<String>();940 SymbolMap<ITask, String> symbolMap2 = new TaskSymbolIdentityMap<String>(); 942 941 943 942 int entryCount = 1000; 944 943 945 944 for (int i = 0; i < entryCount; i++) { 946 ITask Instance task = createTaskInstance("symbol" + i);945 ITask task = createTask("symbol" + i); 947 946 if (i % 7 == 0) { 948 947 symbolMap1.addSymbol(task, "value" + i); … … 962 961 @Test 963 962 public void testEquals_6() { 964 SymbolMap<ITask Instance, String> symbolMap1 = new TaskSymbolIdentityMap<String>();963 SymbolMap<ITask, String> symbolMap1 = new TaskSymbolIdentityMap<String>(); 965 964 966 SymbolMap<ITask Instance, String> symbolMap2 = new TaskSymbolIdentityMap<String>();965 SymbolMap<ITask, String> symbolMap2 = new TaskSymbolIdentityMap<String>(); 967 966 968 967 int entryCount = 1000; 969 968 970 ITask Instance[] taskInstances = new ITaskInstance[entryCount];971 972 for (int i = 0; i < entryCount; i++) { 973 ITask Instance task = createTaskInstance("symbol" + i);974 task Instances[i] = task;969 ITask[] tasks = new ITask[entryCount]; 970 971 for (int i = 0; i < entryCount; i++) { 972 ITask task = createTask("symbol" + i); 973 tasks[i] = task; 975 974 symbolMap1.addSymbol(task, "value" + i); 976 975 assertFalse(symbolMap1.equals(symbolMap2)); … … 980 979 981 980 for (int i = 150; i < (entryCount - 150); i++) { 982 symbolMap1.removeSymbol(task Instances[i]);981 symbolMap1.removeSymbol(tasks[i]); 983 982 assertFalse(symbolMap1.equals(symbolMap2)); 984 symbolMap2.removeSymbol(task Instances[i]);983 symbolMap2.removeSymbol(tasks[i]); 985 984 assertTrue(symbolMap1.equals(symbolMap2)); 986 985 } … … 989 988 @Test 990 989 public void testPerformance_Contains_1() { 991 SymbolMap<ITask Instance, String> symbolMap1 = new TaskSymbolIdentityMap<String>();990 SymbolMap<ITask, String> symbolMap1 = new TaskSymbolIdentityMap<String>(); 992 991 int mapSize = 100000; 993 992 int noOfLookups = 1000000; 994 993 995 ITask Instance[] taskInstances = new ITaskInstance[mapSize];994 ITask[] tasks = new ITask[mapSize]; 996 995 997 996 for (int i = 0; i < mapSize; i++) { 998 ITask Instance task = createTaskInstance("symbol" + i);999 task Instances[i] = task;997 ITask task = createTask("symbol" + i); 998 tasks[i] = task; 1000 999 symbolMap1.addSymbol(task, "value" + i); 1001 1000 } … … 1003 1002 long start = System.currentTimeMillis(); 1004 1003 for (int i = 0; i < noOfLookups; i++) { 1005 symbolMap1.containsSymbol(task Instances[noOfLookups % mapSize]);1004 symbolMap1.containsSymbol(tasks[noOfLookups % mapSize]); 1006 1005 } 1007 1006 … … 1012 1011 @Test 1013 1012 public void testPerformance_GetValue_1() { 1014 SymbolMap<ITask Instance, String> symbolMap1 = new TaskSymbolIdentityMap<String>();1013 SymbolMap<ITask, String> symbolMap1 = new TaskSymbolIdentityMap<String>(); 1015 1014 int mapSize = 100000; 1016 1015 int noOfLookups = 1000000; 1017 1016 1018 ITask Instance[] taskInstances = new ITaskInstance[mapSize];1017 ITask[] tasks = new ITask[mapSize]; 1019 1018 1020 1019 for (int i = 0; i < mapSize; i++) { 1021 ITask Instance task = createTaskInstance("symbol" + i);1022 task Instances[i] = task;1020 ITask task = createTask("symbol" + i); 1021 tasks[i] = task; 1023 1022 symbolMap1.addSymbol(task, "value" + i); 1024 1023 } … … 1026 1025 long start = System.currentTimeMillis(); 1027 1026 for (int i = 0; i < noOfLookups; i++) { 1028 symbolMap1.getValue(task Instances[noOfLookups % mapSize]);1027 symbolMap1.getValue(tasks[noOfLookups % mapSize]); 1029 1028 } 1030 1029 … … 1036 1035 @Test 1037 1036 public void testPerformance_AddRemove_1() { 1038 SymbolMap<ITask Instance, String> symbolMap1 = new TaskSymbolIdentityMap<String>();1037 SymbolMap<ITask, String> symbolMap1 = new TaskSymbolIdentityMap<String>(); 1039 1038 int mapSize = 100000; 1040 1039 int noOfLookups = 1000000; 1041 1040 1042 ITask Instance[] taskInstances = new ITaskInstance[mapSize];1041 ITask[] tasks = new ITask[mapSize]; 1043 1042 1044 1043 for (int i = 0; i < mapSize; i++) { 1045 ITask Instance task = createTaskInstance("symbol" + i);1046 task Instances[i] = task;1044 ITask task = createTask("symbol" + i); 1045 tasks[i] = task; 1047 1046 symbolMap1.addSymbol(task, "value" + i); 1048 1047 } … … 1050 1049 long start = System.currentTimeMillis(); 1051 1050 for (int i = 0; i < noOfLookups; i++) { 1052 ITask Instance task = taskInstances[noOfLookups % mapSize];1051 ITask task = tasks[noOfLookups % mapSize]; 1053 1052 symbolMap1.addSymbol(task, symbolMap1.removeSymbol(task)); 1054 1053 } … … 1061 1060 * 1062 1061 */ 1063 private ITask Instance createTaskInstance(String id) {1062 private ITask createTask(String id) { 1064 1063 ITask task = tasks.get(id); 1065 1064 Event event = null; … … 1075 1074 } 1076 1075 1077 return taskFactory.createNewTaskInstance((IEventTask) task, event); 1078 } 1079 1080 private void assertSymbolMapEntries(SymbolMap<ITaskInstance, String> symbolMap, 1081 ITaskInstance[] symbols, 1082 String[] values) 1076 taskFactory.createNewTaskInstance((IEventTask) task, event); 1077 1078 return task; 1079 } 1080 1081 private void assertSymbolMapEntries(SymbolMap<ITask, String> symbolMap, 1082 ITask[] symbols, 1083 String[] values) 1083 1084 { 1084 1085 assertEquals(symbols.length, symbolMap.size());
Note: See TracChangeset
for help on using the changeset viewer.