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.

1  
sclass PtBuffer > RandomAccessAbstractList<Pt> {
2  
  LongBuffer buf = new LongBuffer;
3  
  
4  
  *() {}
5  
  *(int size) { buf.allocate(size); }
6  
  
7  
  *(Iterable<Pt> l) {
8  
    if (l != null) for (Pt p : l) add(p);
9  
  }
10  
  
11  
  public int size() { ret buf.size(); }
12  
  
13  
  public Pt get(int i) {
14  
    ret longToPt(buf.get(i));
15  
  }
16  
  
17  
  public long getLong(int i) {
18  
    ret buf.get(i);
19  
  }
20  
  
21  
  public Pt set(int i, Pt val) {
22  
    Pt old = get(i);
23  
    buf.set(i, ptToLong(val));
24  
    ret old;
25  
  }
26  
  
27  
  public bool add(Pt p) {
28  
    buf.add(ptToLong(p));
29  
    true;
30  
  }
31  
  
32  
  public void add(int x, int y) {
33  
    buf.add(ptToLong(x, y));
34  
  }
35  
  
36  
  public Pt remove(int i) {
37  
    Pt p = get(i);
38  
    buf.remove(i);
39  
    ret p;
40  
  }
41  
  
42  
  public void clear { buf.clear(); }
43  
}

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: 170 / 349
Version history: 12 change(s)
Referenced in: [show references]