diff 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
line wrap: on
line diff
--- a/src/main/java/org/mpi/openmind/cache/CacheService.java	Fri Feb 03 12:56:28 2017 +0100
+++ b/src/main/java/org/mpi/openmind/cache/CacheService.java	Thu Feb 23 19:05:47 2017 +0100
@@ -529,14 +529,18 @@
 				diff.modifiedSrcRels.add(rel);
 			}
 			if (!cacheSrcRels.remove(rel)) {
+				// rel was not in cache
 				boolean found = false;
 				for (Relation cr : cacheSrcRels) {
+					// check all cached relations
 					if (cr.getId() == rel.getId()) {
+						// relation id is same
 						cacheSrcRels.remove(cr);
 						found = true;
 						break;
 					} else if (acceptNewIDs && cr.equalsContent(rel)) {
-						// same content is good enough
+						// same content is good enough 
+						// (includes checks for src and tar id)
 						cacheSrcRels.remove(cr);
 						found = true;
 						break;
@@ -564,14 +568,18 @@
 				diff.modifiedTarRels.add(rel);
 			}
 			if (!cacheTarRels.remove(rel)) {
+				// rel was not in cache
 				boolean found = false;
 				for (Relation cr : cacheTarRels) {
+					// check all cached relations
 					if (cr.getId() == rel.getId()) {
+						// relation id is same
 						cacheTarRels.remove(cr);
 						found = true;
 						break;
 					} else if (acceptNewIDs && cr.equalsContent(rel)) {
-						// same content is good enough
+						// same content is good enough 
+						// (includes checks for src and tar id)
 						cacheTarRels.remove(cr);
 						found = true;
 						break;