concept Str extends DefiniteThing { S name; new L<S> otherNames; *() {} *(S *name) {} public S toString() { ret name; } } static Str concept(S name) { for (Str s : list(Str.class)) if (eqic(s.name, name) || containsIgnoreCase(s.otherNames, name)) ret s; ret new Str(name); } static void mergeStrs(Str a, Str b) { if (a == b) ret; if (nempty(b.backRefs)) { Str t = a; a = b; b = t; } a.otherNames.add(b.name); a.otherNames.addAll(b.otherNames); if (nempty(b.backRefs)) print("Warning: Deleting concept with back references - " + b.name); b.delete(); }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005279 |
Snippet name: | class Str (string concept with synonyms) / function "concept" / mergeStrs |
Eternal ID of this version: | #1005279/1 |
Text MD5: | b160e29f92bb8e49e0fd3a9e8baabc1a |
Author: | stefan |
Category: | javax / concepts |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-11-05 19:03:58 |
Source code size: | 645 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 531 / 957 |
Referenced in: | [show references] |