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

22
LINES

< > BotCompany Repo | #1031198 // renderLineCompedSingleLevels - as monospaced text

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3316L/20K).

sS renderLineCompedSingleLevels(LineCompedSingle<Char> lc) {
  // each byte is the character's "color"
  // (0 for empty, 1 for color one, 2 for color two)
  byte[][] rows = renderLineCompedSingleLevels_raw(lc);
  S text = uncompressLineCompedSingle(lc);
  //printVars(+rows);
  int n = l(first(rows));
  ret lines(map(rows, row -> {
    StringBuilder buf = new(n);
    for i to n: {
      if (row[i] == 0) 
        buf.append(i == n-1 ? " " : "  ");
      else {
        buf.append(text.charAt(i));
        if (i < n-1)
          buf.append(row[i+1] != 0 && row[i+1] != row[i]
            ? '|' : ' ');
      }
    }
    ret str(buf);
  }));
}

Author comment

Began life as a copy of #1028482

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1031198
Snippet name: renderLineCompedSingleLevels - as monospaced text
Eternal ID of this version: #1031198/25
Text MD5: afd156b019661d6dec9623100aa8b589
Transpilation MD5: c3c445c31a96bb4a7c9af15f8337d6de
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-20 14:57:59
Source code size: 667 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 132 / 227
Version history: 24 change(s)
Referenced in: [show references]