1 | // slightly experimental - also uses allChanged() which might not be |
2 | // so good with future logging |
3 | svoid swapConceptIDs(Concept a, Concept b) { |
4 | Concepts concepts = a._concepts; |
5 | if (concepts != b._concepts) fail("Concepts belong to different set"); |
6 | long id1 = a.id, id2 = b.id; |
7 | if (concepts == null) { a.id = id2; b.id = id1; ret; } |
8 | lock concepts.lock; |
9 | a.id = id2; |
10 | b.id = id1; |
11 | concepts.concepts.put(id2, a); |
12 | concepts.concepts.put(id1, b); |
13 | a.change(); |
14 | b.change(); |
15 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1021789 |
Snippet name: | swapConceptIDs - actually change the concepts' IDs |
Eternal ID of this version: | #1021789/6 |
Text MD5: | f0da7ed02aa0d7833bd33cb8f6eaea55 |
Author: | stefan |
Category: | javax / concepts |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-07-01 16:05:31 |
Source code size: | 500 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 297 / 333 |
Version history: | 5 change(s) |
Referenced in: | [show references] |