// the map is: invalidated id -> invalidators static DependentCache<MultiMap<GlobalID>> ai_invalidatedWebs_cache = new DependentCache(f ai_invalidatedWebs_calc, f cachedNodeIndex /*_changeCount*/); static Set<GlobalID> ai_invalidatedWebs() { ret keys(ai_invalidatedWebs_cache!); } static MultiMap<GlobalID> ai_invalidatedWebs_calc() { //print("ai_invalidatedWebs_calc"); ai_onNewOrRemovedWeb(f ai_invalidatedWebs_onNewWeb, f ai_invalidatedWebs_onRemovedWeb); ai_invalidatedWebs_cache.set(new MultiMap); // old method //Collection<Web> webs = allWebsFromCachedNodeIndex_uncached(); //print("Have " + nWebs(webs)); //for (Web web : webs) // ai_invalidatedWebs_onNewWeb(web); // new method new Matches m; for (WebNode n : indexedNodes_withInvalids("invalid")) for (WebRelation r : web_backwardRelations(n)) if (web_hasLabelIC(r, "is") && web_match("Web *", r.a, m) && isGlobalID($1)) ai_invalidatedWebs_cache->put(asGlobalID($1), r.web.globalIDObj()); print("ai_invalidatedWebs calc done with " + n2(ai_invalidatedWebs_cache->keysSize(), "invalidated web", "invalidated webs")); ret ai_invalidatedWebs_cache!; } svoid ai_invalidatedWebs_onNewWeb(Web web) { if (web.unverified) ret; lock ai_invalidatedWebs_cache.lock; new Matches m; for (WebNode n : web_search_dollarX(webFromTriple("$X", "is", "invalid"), web)) if (web_match("Web *", n, m) && isGlobalID($1)) ai_invalidatedWebs_cache->put(asGlobalID($1), web.globalIDObj()); } svoid ai_invalidatedWebs_onRemovedWeb(Web web) { if (web.unverified) ret; lock ai_invalidatedWebs_cache.lock; new Matches m; for (WebNode n : web_search_dollarX(webFromTriple("$X", "is", "invalid"), web)) if (web_match("Web *", n, m) && isGlobalID($1)) ai_invalidatedWebs_cache->remove(asGlobalID($1), web.globalIDObj()); } svoid ai_invalidatedWebs_cache_put(GlobalID a, GlobalID b) { ai_invalidatedWebs_cache->put(a, b); }
Began life as a copy of #1011311
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1011416 |
Snippet name: | ai_invalidatedWebs - returns Set<S> - only verified information is counted |
Eternal ID of this version: | #1011416/21 |
Text MD5: | f998490650cc95ec1178b46b46db743b |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-12-15 00:03:13 |
Source code size: | 2006 bytes / 52 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 569 / 592 |
Version history: | 20 change(s) |
Referenced in: | [show references] |