Mercurial > hg > openmind
comparison src/main/java/org/mpi/openmind/cache/CacheService.java @ 75:e0be7c0030f5
cleanup and better comments.
author | casties |
---|---|
date | Thu, 23 Feb 2017 19:05:47 +0100 |
parents | 677492395dc0 |
children |
comparison
equal
deleted
inserted
replaced
74:7acd7564e394 | 75:e0be7c0030f5 |
---|---|
527 for (Relation rel : entSrcRels) { | 527 for (Relation rel : entSrcRels) { |
528 if (!isRelCurrent(rel)) { | 528 if (!isRelCurrent(rel)) { |
529 diff.modifiedSrcRels.add(rel); | 529 diff.modifiedSrcRels.add(rel); |
530 } | 530 } |
531 if (!cacheSrcRels.remove(rel)) { | 531 if (!cacheSrcRels.remove(rel)) { |
532 // rel was not in cache | |
532 boolean found = false; | 533 boolean found = false; |
533 for (Relation cr : cacheSrcRels) { | 534 for (Relation cr : cacheSrcRels) { |
535 // check all cached relations | |
534 if (cr.getId() == rel.getId()) { | 536 if (cr.getId() == rel.getId()) { |
537 // relation id is same | |
535 cacheSrcRels.remove(cr); | 538 cacheSrcRels.remove(cr); |
536 found = true; | 539 found = true; |
537 break; | 540 break; |
538 } else if (acceptNewIDs && cr.equalsContent(rel)) { | 541 } else if (acceptNewIDs && cr.equalsContent(rel)) { |
539 // same content is good enough | 542 // same content is good enough |
543 // (includes checks for src and tar id) | |
540 cacheSrcRels.remove(cr); | 544 cacheSrcRels.remove(cr); |
541 found = true; | 545 found = true; |
542 break; | 546 break; |
543 } | 547 } |
544 } | 548 } |
562 for (Relation rel : entTarRels) { | 566 for (Relation rel : entTarRels) { |
563 if (!isRelCurrent(rel)) { | 567 if (!isRelCurrent(rel)) { |
564 diff.modifiedTarRels.add(rel); | 568 diff.modifiedTarRels.add(rel); |
565 } | 569 } |
566 if (!cacheTarRels.remove(rel)) { | 570 if (!cacheTarRels.remove(rel)) { |
571 // rel was not in cache | |
567 boolean found = false; | 572 boolean found = false; |
568 for (Relation cr : cacheTarRels) { | 573 for (Relation cr : cacheTarRels) { |
574 // check all cached relations | |
569 if (cr.getId() == rel.getId()) { | 575 if (cr.getId() == rel.getId()) { |
576 // relation id is same | |
570 cacheTarRels.remove(cr); | 577 cacheTarRels.remove(cr); |
571 found = true; | 578 found = true; |
572 break; | 579 break; |
573 } else if (acceptNewIDs && cr.equalsContent(rel)) { | 580 } else if (acceptNewIDs && cr.equalsContent(rel)) { |
574 // same content is good enough | 581 // same content is good enough |
582 // (includes checks for src and tar id) | |
575 cacheTarRels.remove(cr); | 583 cacheTarRels.remove(cr); |
576 found = true; | 584 found = true; |
577 break; | 585 break; |
578 } | 586 } |
579 } | 587 } |