Libraryless. Click here for Pure Java version (12678L/85K).
1 | static <A extends Concept> void importAllConceptsOfType(Class<A> cClass, Cl<A> l, O... _) { |
2 | bool debug = boolPar debug(_); |
3 | |
4 | Concepts cc = db_mainConcepts(); |
5 | Set<Long> ids = mapToSet(l, c -> c.id); |
6 | fOr (A c : l) { |
7 | A existing = cast cc.getConcept(c.id); |
8 | if (existing == null) { |
9 | if (debug) print("import: adding " + c); |
10 | cc.registerKeepingID(existing = c); |
11 | } else { |
12 | if (debug) print("import: updating " + c); |
13 | copyConceptFields(c, existing); |
14 | } |
15 | } |
16 | for (A c : cloneList(list(cc, cClass))) |
17 | if (!ids.contains(c.id)) { |
18 | if (debug) print("import: deleting " + c); |
19 | deleteConcept(c); |
20 | } |
21 | } |
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1026289 |
Snippet name: | importAllConceptsOfType - delete all concepts of type cClass and replace them with a list of unlisted concepts including IDs |
Eternal ID of this version: | #1026289/3 |
Text MD5: | a8c5b20ba487f557dbd93d9ba3e3b208 |
Transpilation MD5: | b4a916c03f6e21429194da67fd416bd9 |
Author: | stefan |
Category: | javax / comm |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-12-11 19:18:08 |
Source code size: | 666 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 211 / 312 |
Version history: | 2 change(s) |
Referenced in: | [show references] |