Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

27
LINES

< > BotCompany Repo | #1031204 // renderLineCompedSingleLevels_raw_v3 [abandoned]

JavaX fragment (include)

1  
scope renderLineCompedSingleLevels_raw_v3.
2  
3  
static long[][] renderLineCompedSingleLevels_raw_v3(LineCompedSingle<Char> lc) {
4  
  int n = lcLength(lc);
5  
  
6  
  // each matrix element is the character's symbol number+1 combined with its starting position (or 0 for empty)
7  
  L<long[]> rows = new AutoCreateList<>(() -> new long[n]);
8  
  fill(lc, rows, 0, 0, lc.main);
9  
  ret toArray(rows, long[].class);
10  
}
11  
  
12  
// returns new x
13  
static int #fill(LineCompedSingle<Char> lc, L<long[]> 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] = twoIntsToLong(idx+1);
18  
      x++;
19  
    } else {
20  
      int newX = fill(lc, rows, x, y+1, intPairToList(lc.getPair(idx)));
21  
      while (x < newX) rows.get(y)[x++] = idx+1;
22  
    }
23  
  }
24  
  ret x;
25  
}
26  
27  
end scope

Author comment

Began life as a copy of #1031202

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031204
Snippet name: renderLineCompedSingleLevels_raw_v3 [abandoned]
Eternal ID of this version: #1031204/1
Text MD5: e59a4361facd3a5a1fbd30a24609f4cc
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:13:48
Source code size: 857 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 164 / 164
Referenced in: [show references]