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

34
LINES

< > BotCompany Repo | #1005064 // findConceptsWhere

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

Libraryless. Click here for Pure Java version (14783L/95K).

static <A extends Concept> Cl<A> findConceptsWhere(Class<A> c, O... params) {
  ret findConceptsWhere(db_mainConcepts(), c, params);
}

static Cl<Concept> findConceptsWhere(S c, O... params) {
  ret findConceptsWhere(db_mainConcepts(), c, params);
}

static <A extends Concept> Cl<A> findConceptsWhere(Concepts concepts, Class<A> c, O... params) {
  ping();
  params = expandParams(c, params);
  
  // indexed
  if (concepts.fieldIndices != null)
    for (int i = 0; i < l(params); i += 2) {
      IFieldIndex<A, O> index = concepts.getFieldIndex(c, (S) params[i]);
      if (index != null) {
        Cl<A> rawList = index.getAll(params[i+1]);
        params = dropEntryFromParams(params, i);
        if (params == null) ret rawList;
        new L<A> l;
        for (A x : rawList)
          if (checkConceptFields(x, params)) l.add(x);
        ret l;
      }
    }
    
  // table scan
  ret filterConcepts(concepts.list(c), params);
}

static Cl<Concept> findConceptsWhere(Concepts concepts, S c, O... params) {
  ret filterConcepts(concepts.list(c), params);
}

Author comment

Began life as a copy of #1005060

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005064
Snippet name: findConceptsWhere
Eternal ID of this version: #1005064/8
Text MD5: 1bb92bad3fe25e2692b31c3b00ed1a7e
Transpilation MD5: 49143822db02ab8472237a7f7b85c308
Author: stefan
Category: javax / concepts
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-03-19 17:46:40
Source code size: 1096 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 638 / 675
Version history: 7 change(s)
Referenced in: [show references]