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

32
LINES

< > BotCompany Repo | #1024411 // LogNArray [dev.]

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

Transpiled version (12768L) is out of date.

sclass LogNArray<A> extends RandomAccessAbstractList<A> {
  class Node {
    O a, b; // Node or A
    int size;
    
    int get(int i) {
      if (i >= a)
    }
  }
  
  bool empty;
  O root;
  
  int nodeSize(O o) {
    if (o cast Node) ret o.size;
    ret 1;
  }
  
  public int size() {
    if (empty) ret 0;
    if (root cast Node) ret root.size;
    ret 1;
  }
  
  public A get(int i) {
    if (i < 0 || empty || i >= size()) throw new IndexOutOfBoundsException();
    if (root cast Node) {
      ret node.get(i);
    }
    ret (A) root;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024411
Snippet name: LogNArray [dev.]
Eternal ID of this version: #1024411/2
Text MD5: c3975f30c57b9c5b4e20533c9b6d6997
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-11 01:41:22
Source code size: 581 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 218 / 284
Version history: 1 change(s)
Referenced in: [show references]