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

42
LINES

< > BotCompany Repo | #1011019 // findConceptWhere_debug

JavaX fragment (include)

1  
static new ThreadLocal<Long> findConceptWhere_debug_scanned;
2  
3  
static <A extends Concept> A findConceptWhere_debug(Class<A> c, O... params) {
4  
  ret findConceptWhere(mainConcepts, c, params);
5  
}
6  
7  
static <A extends Concept> A findConceptWhere_debug(Concepts concepts, Class<A> c, O... params) {
8  
  params = expandParams(c, params);
9  
  
10  
  int scanned = 0;
11  
  try {
12  
    
13  
    // indexed
14  
    if (concepts.fieldIndices != null)
15  
      for (int i = 0; i < l(params); i += 2) {
16  
        IFieldIndex<A, O> index = concepts.getFieldIndex(c, (S) params[i]);
17  
        if (index != null) {
18  
          for (A x : index.getAll(params[i+1])) {
19  
            ++scanned;
20  
            if (checkConceptFields(x, params)) ret x;
21  
          }
22  
          null;
23  
        }
24  
      }
25  
      
26  
    // table scan
27  
    for (A x : concepts.list(c)) if (checkConceptFields(x, params)) ret x;
28  
    null;
29  
  } finally {
30  
    addToLongThreadLocal(findConceptWhere_debug_scanned, scanned);
31  
  }
32  
}
33  
34  
static Concept findConceptWhere_debug(Concepts concepts, S c, O... params) {
35  
  int scanned = 0;
36  
  try {
37  
    for (Concept x : concepts.list(c)) { ++scanned; if (checkConceptFields(x, params)) ret x; }
38  
    null;
39  
  } finally {
40  
    addToLongThreadLocal(findConceptWhere_debug_scanned, scanned);
41  
  }
42  
}

Author comment

Began life as a copy of #1005039

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: #1011019
Snippet name: findConceptWhere_debug
Eternal ID of this version: #1011019/3
Text MD5: 888db291a7ed3bf365bc8bae815b9401
Author: stefan
Category: javax / concepts
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-11 18:59:33
Source code size: 1278 bytes / 42 lines
Pitched / IR pitched: No / No
Views / Downloads: 323 / 360
Version history: 2 change(s)
Referenced in: [show references]