Libraryless. Click here for Pure Java version (13645L/93K).
1 | // tries to use index if possible |
2 | // result is sorted if index was used |
3 | // result is always an independent collection |
4 | static <A extends Concept> Cl<A> nuLike conceptsWithFieldLessThanOrEqualTo_sorted(Class<A> c, S field, O value) { |
5 | ret conceptsWithFieldLessThanOrEqualTo_sorted(db_mainConcepts(), c, field, value); |
6 | } |
7 | |
8 | static <A extends Concept> Cl<A> conceptsWithFieldLessThanOrEqualTo_sorted(Concepts concepts, Class<A> c, S field, O value) { |
9 | // indexed |
10 | IFieldIndex<A, O> index = concepts.getFieldIndex(c, field); |
11 | if (index cast ConceptFieldIndexDesc) synchronized(index.mutex()) { |
12 | ret reverseInPlace(concatLists(values(((NavigableMap) index.valueToObject.data).tailMap(value, true)))); |
13 | } |
14 | |
15 | // filter manually |
16 | ret sortByFieldInPlace(field, filter(concepts.list(c), o -> cmp(getOpt(o, field), value) <= 0)); |
17 | } |
Began life as a copy of #1029649
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: | #1029653 |
Snippet name: | conceptsWithFieldLessThanOrEqualTo_sorted - also sort by field |
Eternal ID of this version: | #1029653/3 |
Text MD5: | 8304d56336309ad565fe3fcca1d0047c |
Transpilation MD5: | 36f7010880b2fd2c34ad78180e45a311 |
Author: | stefan |
Category: | javax / concepts |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-09-04 21:07:15 |
Source code size: | 847 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 163 / 237 |
Version history: | 2 change(s) |
Referenced in: | [show references] |