// 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 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; }