Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

23
LINES

< > BotCompany Repo | #1030999 // quickImportMainConcepts - old version, probably doesn't work with RefL

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (15116L/97K).

1  
// assumes main concepts are empty before
2  
// only works when you call db() afterwards
3  
svoid quickImportMainConcepts(virtual Concepts oldConcepts, IF0<Bool> enabled default null) {
4  
  if (!shortNameIs(oldConcepts, "Concepts")) ret;
5  
  Concepts concepts = db_mainConcepts();
6  
  concepts.miscMapPut("dbGrabber", func -> Bool {
7  
    concepts.miscMapRemove("dbGrabber");
8  
    pcall {
9  
      if (isFalse(callF(enabled))) false;
10  
      concepts.idCounter = getLong idCounter(oldConcepts);
11  
      printVars_str(idCounter := concepts.idCounter);
12  
      Map<Long, virtual Concept> oldMap = cast _get concepts(oldConcepts);
13  
      printVars_str(+oldMap);
14  
      concepts.concepts.putAll((Map<Long, Concept>) quickImport_unlisted(oldMap));
15  
      
16  
      // Note: this calls _doneLoading2() on all concepts
17  
      concepts.assignConceptsToUs();
18  
      print(nConcepts(countConcepts()) + " quick-imported");
19  
      true;
20  
    }
21  
    false;
22  
  });
23  
}

Author comment

Began life as a copy of #1030881

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030999
Snippet name: quickImportMainConcepts - old version, probably doesn't work with RefL
Eternal ID of this version: #1030999/2
Text MD5: 2d32c3198bd99736bd4195eb8f7213ce
Transpilation MD5: e16f14f9d87427dd818015a5426cec6d
Author: stefan
Category: javax / concepts
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-04-19 14:13:16
Source code size: 938 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 203 / 281
Version history: 1 change(s)
Referenced in: [show references]