Uses 11335K of libraries. Click here for Pure Java version (4622L/29K).
1 | scope lcStream_itemCounts. |
2 | |
3 | // counts how often an item actually appears in the text |
4 | static MultiSet<Int> lcStream_itemCounts(LCStreamingCompressor comp) {
|
5 | new MultiSet<Int> ms; |
6 | for (int idx : comp.chain.toList()) |
7 | recurse(comp, ms, idx); |
8 | ret ms; |
9 | } |
10 | |
11 | svoid #recurse(LCStreamingCompressor comp, MultiSet<Int> ms, int idx) {
|
12 | ms.add(idx); |
13 | IntPair p = comp.getPair(idx); |
14 | if (p != null) {
|
15 | recurse(comp, ms, p.a); |
16 | recurse(comp, ms, p.b); |
17 | } |
18 | } |
19 | |
20 | end scope |
Began life as a copy of #1029110
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: | #1029115 |
| Snippet name: | lcStream_itemCounts |
| Eternal ID of this version: | #1029115/6 |
| Text MD5: | 807613c1fdf6db799914ac97ab17ebdd |
| Transpilation MD5: | 51531a14a1b66dcc805055cba72093c0 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-07-20 01:35:58 |
| Source code size: | 489 bytes / 20 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 425 / 543 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |