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

19
LINES

< > BotCompany Repo | #1017184 // PlanInMotion

JavaX fragment (include)

1  
sclass PlanInMotion<A> extends DynamicObject {
2  
  L<A> doneSteps = synchroList();
3  
  L<A> plannedSteps = synchroLinkedList();
4  
  volatile bool paused, cancelled;
5  
  
6  
  *() {}
7  
  *(Iterable<A> l) { addAll(plannedSteps, l); }
8  
  
9  
  void add(A a) { plannedSteps.add(a); }
10  
  
11  
  IterableIterator<A> master() {
12  
    ret iteratorFromFunction(func -> A { master_next() });
13  
  }
14  
  
15  
  A master_next() {
16  
    ret paused || cancelled ? null
17  
      : addAndReturnIfNotNull(doneSteps, syncPopFirst(plannedSteps));
18  
  }
19  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1017184
Snippet name: PlanInMotion
Eternal ID of this version: #1017184/10
Text MD5: 587e84152e5b2f5df0dae954ccc1ac99
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-23 16:55:20
Source code size: 513 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 368 / 922
Version history: 9 change(s)
Referenced in: [show references]