1 | concept Str extends DefiniteThing {
|
2 | S name; |
3 | new L<S> otherNames; |
4 | |
5 | *() {}
|
6 | *(S *name) {}
|
7 | |
8 | public S toString() { ret name; }
|
9 | } |
10 | |
11 | static Str concept(S name) {
|
12 | for (Str s : list(Str.class)) |
13 | if (eqic(s.name, name) || containsIgnoreCase(s.otherNames, name)) |
14 | ret s; |
15 | ret new Str(name); |
16 | } |
17 | |
18 | static void mergeStrs(Str a, Str b) {
|
19 | if (a == b) ret; |
20 | if (nempty(b.backRefs)) {
|
21 | Str t = a; |
22 | a = b; |
23 | b = t; |
24 | } |
25 | a.otherNames.add(b.name); |
26 | a.otherNames.addAll(b.otherNames); |
27 | if (nempty(b.backRefs)) |
28 | print("Warning: Deleting concept with back references - " + b.name);
|
29 | b.delete(); |
30 | } |
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: | 784 / 1210 |
| Referenced in: | [show references] |