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).

1  
sbool conceptsSortedByFieldDesc_verbose;
2  
3  
static <A extends Concept> Cl<A> nuLike conceptsSortedByFieldDesc(Class<A> c, S field) {
4  
  ret conceptsSortedByFieldDesc(db_mainConcepts(), c, field);
5  
}
6  
7  
static <A extends Concept> Cl<A> conceptsSortedByFieldDesc(Concepts concepts, Class<A> c, S field) {
8  
  // indexed
9  
  IFieldIndex<A, O> index = concepts.getFieldIndex(c, field);
10  
  if (index cast ConceptFieldIndexDesc)
11  
    ret (Cl<A>) asList(index.objectIterator());
12  
    
13  
  // sort manually
14  
  if (conceptsSortedByFieldDesc_verbose)
15  
    print("conceptsSortedByFieldDesc_verbose: Manual sort of " + c + " for " + field);
16  
  ret sortedByFieldDesc(field, concepts.list(c));
17  
}

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: 212 / 307
Referenced in: [show references]