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

20
LINES

< > BotCompany Repo | #1034092 // ComputerCountListener

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

Libraryless. Click here for Pure Java version (9653L/58K).

1  
srecord noeq ComputerCountListener(StefansOS_ConnectToServer connector) {
2  
  new VarWithNotify<Int> computerCount;
3  
  bool verbose;
4  
  
5  
  void init {
6  
    connector.onNewLine(line -> {
7  
      new Matches m;
8  
      if (swic(line, "ComputerCount = ", m)) {
9  
        computerCount.set(parseInt(m.rest()));
10  
        if (verbose) print("Computer count: " + get());
11  
      }
12  
    });
13  
    
14  
    connector.sub("computerCount");
15  
  };
16  
  
17  
  LiveValue<Int> liveValue() { ret varWithNotifyToLiveValue(Int, computerCount); }
18  
  
19  
  Int get() { ret computerCount!; }
20  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034092
Snippet name: ComputerCountListener
Eternal ID of this version: #1034092/14
Text MD5: cf237de029bb6f25cd59878cc30e6e7c
Transpilation MD5: fe352e3a71a19ad14eb5367dcb890115
Author: stefan
Category: javax / networking
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-24 13:56:40
Source code size: 559 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 161 / 314
Version history: 13 change(s)
Referenced in: [show references]