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

36
LINES

< > BotCompany Repo | #1016718 // Sock Puppet [Dyn Module]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (7931L/53K).

1  
!7
2  
3  
sclass SockPuppet > DynCalculatedList {
4  
  new L<S> dialog; // user, bot, user, bot...
5  
6  
  void start {
7  
    onUserUtterance(voidfunc(S s) {
8  
      addUserUtterance(s)
9  
    });
10  
    onBotUtterance(voidfunc(S s) {
11  
      addBotUtterance(s)
12  
    });
13  
  }
14  
15  
  void addUserUtterance(S s) {
16  
    synchronized(dialog) {
17  
      if (odd(l(dialog))) dialog.add("");
18  
      add(dialog, s);
19  
      updateMe();
20  
      scrollDown();
21  
    }
22  
  }
23  
  
24  
  void addBotUtterance(S s) {
25  
    synchronized(dialog) {
26  
      if (even(l(dialog))) dialog.add("");
27  
      add(dialog, s);
28  
      updateMe();
29  
      scrollDown();
30  
    }
31  
  }
32  
33  
  L<S> calc() {
34  
    ret dialog;
35  
  }
36  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1016718
Snippet name: Sock Puppet [Dyn Module]
Eternal ID of this version: #1016718/4
Text MD5: e1e284c8fc3c43c7267fe05bb58ea593
Transpilation MD5: 6df9d7cc3535c54c62b71a779919724c
Author: stefan
Category:
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-29 16:04:30
Source code size: 667 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 306 / 1010
Version history: 3 change(s)
Referenced in: [show references]