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

43
LINES

< > BotCompany Repo | #1033756 // PtBuffer

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

Transpiled version (5525L) is out of date.

sclass PtBuffer > RandomAccessAbstractList<Pt> {
  LongBuffer buf = new LongBuffer;
  
  *() {}
  *(int size) { buf.allocate(size); }
  
  *(Iterable<Pt> l) {
    if (l != null) for (Pt p : l) add(p);
  }
  
  public int size() { ret buf.size(); }
  
  public Pt get(int i) {
    ret longToPt(buf.get(i));
  }
  
  public long getLong(int i) {
    ret buf.get(i);
  }
  
  public Pt set(int i, Pt val) {
    Pt old = get(i);
    buf.set(i, ptToLong(val));
    ret old;
  }
  
  public bool add(Pt p) {
    buf.add(ptToLong(p));
    true;
  }
  
  public void add(int x, int y) {
    buf.add(ptToLong(x, y));
  }
  
  public Pt remove(int i) {
    Pt p = get(i);
    buf.remove(i);
    ret p;
  }
  
  public void clear { buf.clear(); }
}

Author comment

Began life as a copy of #1033710

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1033756
Snippet name: PtBuffer
Eternal ID of this version: #1033756/13
Text MD5: c68328a2593d20871747d40883e64d43
Author: stefan
Category: javax / collections
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-26 02:54:19
Source code size: 779 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 111 / 262
Version history: 12 change(s)
Referenced in: [show references]