Libraryless. Click here for Pure Java version (15613L/101K).
// assumes main concepts are empty before // only works when you call db() afterwards svoid quickImportMainConcepts(virtual Concepts oldConcepts, IF0<Bool> enabled default null) { if (!shortNameIs(oldConcepts, "Concepts")) ret; Concepts concepts = db_mainConcepts(); concepts.miscMapPut("dbGrabber", func -> Bool { concepts.miscMapRemove("dbGrabber"); pcall { if (isFalse(callF(enabled))) false; concepts.idCounter = getLong idCounter(oldConcepts); printVars_str(idCounter := concepts.idCounter); Map<Long, virtual Concept> oldMap = cast _get concepts(oldConcepts); printVars_str(+oldMap); new RealmCopy rc; rc.nonTransientOnly = true; rc.fullCopy = true; rc.overrideCollectionOrMapCopy = o -> { rc.classMap.put(_getClass(o), _getClass(o)); false; }; { temp tempSetTL(dynamicObjectIsLoading_threadLocal(), true); concepts.concepts.putAll((Map<Long, Concept>) rc.copy(oldMap)); } pnl("quickImportDB", mapSortedByFunctionOnKey str(rc.classMap)); // Note: this calls _doneLoading2() on all concepts concepts.assignConceptsToUs(); print(nConcepts(countConcepts()) + " quick-imported"); true; } false; }); }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030881 |
Snippet name: | quickImportMainConcepts |
Eternal ID of this version: | #1030881/15 |
Text MD5: | 2d32c6bf174a92a9ec2734f73dbebc86 |
Transpilation MD5: | 13cb40f25fa1e8633d3b2820e00f8c30 |
Author: | stefan |
Category: | javax / concepts |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-24 06:14:43 |
Source code size: | 1316 bytes / 36 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 223 / 342 |
Version history: | 14 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1030999 - quickImportMainConcepts - old version, probably doesn't work with RefL |