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

19
LINES

< > BotCompany Repo | #1017184 // PlanInMotion

JavaX fragment (include)

sclass PlanInMotion<A> extends DynamicObject {
  L<A> doneSteps = synchroList();
  L<A> plannedSteps = synchroLinkedList();
  volatile bool paused, cancelled;
  
  *() {}
  *(Iterable<A> l) { addAll(plannedSteps, l); }
  
  void add(A a) { plannedSteps.add(a); }
  
  IterableIterator<A> master() {
    ret iteratorFromFunction(func -> A { master_next() });
  }
  
  A master_next() {
    ret paused || cancelled ? null
      : addAndReturnIfNotNull(doneSteps, syncPopFirst(plannedSteps));
  }
}

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: 425 / 979
Version history: 9 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)