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

12
LINES

< > BotCompany Repo | #1033379 // ListToMatrix

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

Libraryless. Click here for Pure Java version (5310L/29K).

persistable sclass ListToMatrix<A> extends AbstractMatrix<A> {
  L<A> data;
  
  *(int w, int h, L<A> *data) { super(w, h); }
  
  int xyToIndex(int x, int y) {
    ret y*w+x;
  }

  public A get(int x, int y) { ret data.get(xyToIndex(x, y)); }
  public void set(int x, int y, A a) { data.set(xyToIndex(x, y), a); }
}

Author comment

Began life as a copy of #1033239

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033379
Snippet name: ListToMatrix
Eternal ID of this version: #1033379/4
Text MD5: ab003d124a1a5434df8cdf80264869e1
Transpilation MD5: 12de2dab6b483e16ec8ebbb59dab95c7
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-27 00:04:43
Source code size: 328 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 190 / 266
Version history: 3 change(s)
Referenced in: [show references]