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

42
LINES

< > BotCompany Repo | #1011019 // findConceptWhere_debug

JavaX fragment (include)

static new ThreadLocal<Long> findConceptWhere_debug_scanned;

static <A extends Concept> A findConceptWhere_debug(Class<A> c, O... params) {
  ret findConceptWhere(mainConcepts, c, params);
}

static <A extends Concept> A findConceptWhere_debug(Concepts concepts, Class<A> c, O... params) {
  params = expandParams(c, params);
  
  int scanned = 0;
  try {
    
    // 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) {
          for (A x : index.getAll(params[i+1])) {
            ++scanned;
            if (checkConceptFields(x, params)) ret x;
          }
          null;
        }
      }
      
    // table scan
    for (A x : concepts.list(c)) if (checkConceptFields(x, params)) ret x;
    null;
  } finally {
    addToLongThreadLocal(findConceptWhere_debug_scanned, scanned);
  }
}

static Concept findConceptWhere_debug(Concepts concepts, S c, O... params) {
  int scanned = 0;
  try {
    for (Concept x : concepts.list(c)) { ++scanned; if (checkConceptFields(x, params)) ret x; }
    null;
  } finally {
    addToLongThreadLocal(findConceptWhere_debug_scanned, scanned);
  }
}

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: 319 / 354
Version history: 2 change(s)
Referenced in: [show references]