Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

18
LINES

< > BotCompany Repo | #1025416 // ai_findVarObjects - deep-scan objects and find variables of a custom type

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2468L/16K).

scope ai_findVarObjects.

static <A> L<A> nuLike ai_findVarObjects(Class<A> varClass, O root) {
  ret ai_findVarObjects(varClass, root, null);
}

static <A> L<A> nuLike ai_findVarObjects(Class<A> varClass, O root, IF1<O, Bool> objectFilter) {
  Cl out = transitiveHullOfFunction(o -> #scanObject(o, objectFilter), root);
  ret instancesOf(varClass, out);
}
  
static L #scanObject(O o, IF1<O, Bool> objectFilter) {
  ret filter(nsnpntFieldValues_withoutOuterRefs(o),
    v -> v != null && !v instanceof S
      && (objectFilter == null || objectFilter.get(v)));
}

end scope

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1025416
Snippet name: ai_findVarObjects - deep-scan objects and find variables of a custom type
Eternal ID of this version: #1025416/8
Text MD5: 05770efe237e9313a92fe1660c938a04
Transpilation MD5: c4f13a1d81b9f48c676add57db589676
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-28 21:08:51
Source code size: 591 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 222 / 345
Version history: 7 change(s)
Referenced in: [show references]