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).

// 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);
      concepts.concepts.putAll((Map<Long, Concept>) quickImport_unlisted(oldMap));
      
      // Note: this calls _doneLoading2() on all concepts
      concepts.assignConceptsToUs();
      print(nConcepts(countConcepts()) + " quick-imported");
      true;
    }
    false;
  });
}

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: 201 / 279
Version history: 1 change(s)
Referenced in: [show references]