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

24
LINES

< > BotCompany Repo | #1005339 // xsearch - flexible concept searcher [dev.]

JavaX fragment (include)

// returns a list of var mappings
static L<Map<ISearchVar, O>> xsearch(L<ISearchVar> vars, Class c, O... params) {
  for (ISearchVar v : vars) v.set(null); // reset vars
  params = expandParams(c, params);
  new L<Map<ISearchVar, O>> l;
  for (A concept : list(c))
    if (searchConcept_checkParams(concept, params)) {
      // Success. Record var mapping
      l.add(xsearch_makeVarMapping(vars));
      // Reset vars
      for (ISearchVar v : vars) v.set(null); // reset vars
    }
  ret l;
}

static Map<ISearchVar, O> xsearch_makeVarMapping(L<ISearchVar> vars) {
  new HashMap<ISearchVar, O> map;
  for (ISearchVar v : vars) {
    O o = v.get();
    if (o != null)
      map.put(v, o);
  }
  ret map;
}

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: #1005339
Snippet name: xsearch - flexible concept searcher [dev.]
Eternal ID of this version: #1005339/1
Text MD5: 1f93ae3fe794d1305a5e937391d0d527
Author: stefan
Category: javax / concepts
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-11-07 13:52:51
Source code size: 729 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 414 / 413
Referenced in: