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

17
LINES

< > BotCompany Repo | #1024407 // conceptsSortedByFieldCI - try to use index if possible

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

Libraryless. Click here for Pure Java version (12638L/86K).

sbool conceptsSortedByFieldCI_verbose;

static <A extends Concept> Cl<A> nuLike conceptsSortedByFieldCI(Class<A> c, S field) {
  ret conceptsSortedByFieldCI(db_mainConcepts(), c, field);
}

static <A extends Concept> Cl<A> conceptsSortedByFieldCI(Concepts concepts, Class<A> c, S field) {
  // indexed
  IFieldIndex<A, O> index = concepts.getCIFieldIndex(c, field);
  if (index cast ConceptFieldIndexCI)
    ret (Cl<A>) asList(index.objectIterator());
    
  // sort manually
  if (conceptsSortedByFieldCI_verbose)
    print("conceptsSortedByFieldCI_verbose: Manual sort of " + c + " for " + field);
  ret sortedByFieldIC(field, concepts.list(c));
}

Author comment

Began life as a copy of #1023278

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: #1024407
Snippet name: conceptsSortedByFieldCI - try to use index if possible
Eternal ID of this version: #1024407/7
Text MD5: 083fe630af781f8a5e65f1cabaca89d5
Transpilation MD5: a65d62606606de680e8a95385c6365a8
Author: stefan
Category: javax / concepts
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-10 19:08:12
Source code size: 665 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 263 / 366
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1025936 - conceptsSortedByFieldDesc - try to use index if possible