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

12
LINES

< > BotCompany Repo | #1033585 // PointSetBitMatrix - Set-based implementation of BitMatrix. should be optimized

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

Libraryless. Click here for Pure Java version (5528L/30K).

// implements BitMatrix
persistable sclass PointSetBitMatrix extends AbstractMatrix<Bool> {
  new Set<Pt> points;
  
  *(int *w, int *h) {}
  *(int *w, int *h, Set<Pt> *points) {}

  public Bool get(int x, int y) { ret points.contains(pt(x, y)); }
  public void set(int x, int y, Bool a) { points.add(pt(x, y)); }
  
  int nSetBits() { ret points.size(); }
}

Author comment

Began life as a copy of #1033581

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1033585
Snippet name: PointSetBitMatrix - Set-based implementation of BitMatrix. should be optimized
Eternal ID of this version: #1033585/7
Text MD5: 3472b2949a67e9db289dc35024f6cb2d
Transpilation MD5: 05378c877aef0f9ab9b89a252aea3cfb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-06 20:46:42
Source code size: 369 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 145 / 242
Version history: 6 change(s)
Referenced in: [show references]