// f : Concept -> bool static Concept conceptGraphSearch(Concept c, O f) { ret conceptGraphSearch_impl(c, f, new IdentityHashMap); } static Concept conceptGraphSearch_impl(Concept c, O f, IdentityHashMap<Concept, Concept> seen) { if (seen.containsKey(c)) null; if (callPred(f, c)) ret c; seen.put(c, c); for (S field : conceptFields(c)) { O val = cget(c, field); if (val instanceof Concept) { Concept d = conceptGraphSearch_impl(val/Concept, f, seen); if (d != null) ret d; } } null; }
Began life as a copy of #1005477
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005490 |
Snippet name: | conceptGraphSearch - find a concept in graph that matches predicate |
Eternal ID of this version: | #1005490/1 |
Text MD5: | 3114b988017904405f02c3603d3fc1bf |
Author: | stefan |
Category: | javax / concepts |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-11-23 14:05:05 |
Source code size: | 547 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 668 / 655 |
Referenced in: | [show references] |