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

17
LINES

< > BotCompany Repo | #1025936 // conceptsSortedByFieldDesc - try to use index if possible

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

Libraryless. Click here for Pure Java version (13010L/88K).

sbool conceptsSortedByFieldDesc_verbose;

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

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

Author comment

Began life as a copy of #1024407

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: #1025936
Snippet name: conceptsSortedByFieldDesc - try to use index if possible
Eternal ID of this version: #1025936/1
Text MD5: cac2d3c1a750d8ce6d4e000ae9bf921a
Transpilation MD5: e208f8fcb302fa5b2e48c2660961582a
Author: stefan
Category: javax / concepts
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-31 10:25:32
Source code size: 679 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 159 / 228
Referenced in: [show references]