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)

scope renderLineCompedSingleLevels_raw_v3.

static long[][] renderLineCompedSingleLevels_raw_v3(LineCompedSingle<Char> lc) {
  int n = lcLength(lc);
  
  // each matrix element is the character's symbol number+1 combined with its starting position (or 0 for empty)
  L<long[]> rows = new AutoCreateList<>(() -> new long[n]);
  fill(lc, rows, 0, 0, lc.main);
  ret toArray(rows, long[].class);
}
  
// returns new x
static int #fill(LineCompedSingle<Char> lc, L<long[]> rows, int x, int y, L<Int> symbols) {
  //printVars_str fill(+x, +y, +symbols);
  for (int idx : symbols) {
    if (idx < l(lc.literals)) {
      rows.get(y)[x] = twoIntsToLong(idx+1);
      x++;
    } else {
      int newX = fill(lc, rows, x, y+1, intPairToList(lc.getPair(idx)));
      while (x < newX) rows.get(y)[x++] = idx+1;
    }
  }
  ret x;
}

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: 162 / 161
Referenced in: [show references]