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).

srecord noeq ComputerCountListener(StefansOS_ConnectToServer connector) {
  new VarWithNotify<Int> computerCount;
  bool verbose;
  
  void init {
    connector.onNewLine(line -> {
      new Matches m;
      if (swic(line, "ComputerCount = ", m)) {
        computerCount.set(parseInt(m.rest()));
        if (verbose) print("Computer count: " + get());
      }
    });
    
    connector.sub("computerCount");
  };
  
  LiveValue<Int> liveValue() { ret varWithNotifyToLiveValue(Int, computerCount); }
  
  Int get() { ret computerCount!; }
}

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: 97 / 229
Version history: 13 change(s)
Referenced in: [show references]