Libraryless. Click here for Pure Java version (14780L/95K).
1 | static <A extends Concept> L<A> findBackRefs(Collection<? extends Concept> concepts, Class<A> type) { |
2 | new IdentityHashMap<A, Bool> l; |
3 | for (Concept c : concepts) |
4 | if (c.backRefs != null) for (Concept.Ref r : c.backRefs) |
5 | if (instanceOf(r.concept(), type)) |
6 | l.put((A) r.concept(), true); |
7 | ret asList(keys(l)); |
8 | } |
9 | |
10 | // TODO: sort by ID? |
11 | static <A extends Concept> L<A> findBackRefs(Concept c, Class<A> type) { |
12 | new IdentityHashMap<A, Bool> l; |
13 | if (c != null && c.backRefs != null) for (Concept.Ref r : c.backRefs) |
14 | if (instanceOf(r.concept(), type)) |
15 | l.put((A) r.concept(), true); |
16 | ret asList(keys(l)); |
17 | } |
18 | |
19 | static <A extends Concept> L<A> nuLike findBackRefs(Class<A> type, Concept c) { |
20 | ret findBackRefs(c, type); |
21 | } |
22 | |
23 | static Cl<Concept> findBackRefs(Concept c) { |
24 | ret findBackRefs(c, Concept); |
25 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007228 |
Snippet name: | findBackRefs (for concepts) |
Eternal ID of this version: | #1007228/7 |
Text MD5: | 269b88cad69b592d6e1782ab9ae72b37 |
Transpilation MD5: | c4efef0441a6e5e27a19043bd43524c1 |
Author: | stefan |
Category: | javax / concepts |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-05 15:39:11 |
Source code size: | 850 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 624 / 724 |
Version history: | 6 change(s) |
Referenced in: | [show references] |