Libraryless. Click here for Pure Java version (2977L/18K).
1 | scope renderLineCompedSingleLevels_raw_v2. |
2 | |
3 | static int[][] renderLineCompedSingleLevels_raw_v2(LineCompedSingle<Char> lc) { |
4 | int n = lcLength(lc); |
5 | |
6 | // each matrix element is the symbol starting position for the character+1 (or 0 for empty) |
7 | L<int[]> rows = new AutoCreateList<>(() -> new int[n]); |
8 | fill(lc, rows, 0, 0, lc.main); |
9 | ret toArray(rows, int[].class); |
10 | } |
11 | |
12 | // returns new x |
13 | static int #fill(LineCompedSingle<Char> lc, L<int[]> rows, int x, int y, L<Int> symbols) { |
14 | //printVars_str fill(+x, +y, +symbols); |
15 | for (int idx : symbols) { |
16 | if (idx < l(lc.literals)) { |
17 | rows.get(y)[x] = x+1; |
18 | x++; |
19 | } else { |
20 | int newX = fill(lc, rows, x, y+1, intPairToList(lc.getPair(idx))); |
21 | int x1 = x; |
22 | while (x < newX) rows.get(y)[x++] = x1+1; |
23 | } |
24 | } |
25 | ret x; |
26 | } |
27 | |
28 | end scope |
Began life as a copy of #1031200
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1031202 |
Snippet name: | renderLineCompedSingleLevels_raw_v2 |
Eternal ID of this version: | #1031202/6 |
Text MD5: | b21b3ec932c49056153c7c8966c2da13 |
Transpilation MD5: | da61bdacd66aac5765be555839442872 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-05-20 15:14:32 |
Source code size: | 834 bytes / 28 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 128 / 194 |
Version history: | 5 change(s) |
Referenced in: | [show references] |