Transpiled version (3252L) is out of date.
sclass AllOnAll_probabilistic_forTransformers implements Producer<Pair<F1, O>> { replace A with F1. replace B with O. // We're grouping both a's and b's by the type accepted by the transformers. // Of course things are never this easy because types have subtypes... new MultiMap<Class, A> aList; new MultiMap<Class, B> bList; LPair<Cl<A>, Cl<B>> todo = new LinkedList; // this is still non-probabilistic MultiSetMap<Double, Pair<A, B>> todo2 = multiSetMap_outerDescTreeMap_innerLinkedHashSet(); persistently swappable double probabilityForPair(A a, B b) { ret 1.0; } void addA(A a) { newA(a); } void addAIfNotNull(A a) { if (a != null) newA(a); } synchronized void newA(A a) { add(aList, a); multiSetCombine(bList.get(classesForA(a)); IntRange rB = intRange(0, l(bList)); if (empty(rB)) ret; addPair(todo, intRange_last(aList), rB); } synchronized void newAs(Iterable<A> l) { fOr (A a : l) newA(a); } void addB(B b) { newB(b); } void addBIfNotNull(B b) { if (b != null) newB(b); } synchronized void newB(B b) { add(bList, b); IntRange rA = intRange(0, l(aList)); if (empty(rA)) ret; addPair(todo, rA, intRange_last(bList)); } synchronized void newBs(Iterable<B> l) { fOr (B b : l) newB(b); } public synchronized Pair<A, B> next() { Pair<IntRange> p; while ((p = popFirst(todo)) != null) for (A a : subList(aList, p.a)) for (B b : subList(bList, p.b)) addAPair(a, b, probabilityForPair(a, b)); ret popFirstValueFromMultiSetMap(todo2); } private void addAPair(A a, B b, double probability) { if (probability > 0) todo2.put(probability, pair(a, b)); } synchronized L cloneBList() { ret clonedList(bList); } L<A> getAs() { ret aList; } L<B> getBs() { ret bList; } }
Began life as a copy of #1028466
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1028478 |
| Snippet name: | AllOnAll_probabilistic_forTransformers [dev., possibly faster than AllOnAll_probabilistic, not that easy to make] |
| Eternal ID of this version: | #1028478/6 |
| Text MD5: | da612c9ea01993dfc369c6e4d549020b |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-06-21 01:43:59 |
| Source code size: | 1915 bytes / 65 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 359 / 482 |
| Version history: | 5 change(s) |
| Referenced in: | -