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

16
LINES

< > BotCompany Repo | #1015834 - NotTooOften

JavaX fragment (include)

sclass NotTooOften {
  long minDelay;
  long lastTime;
  
  *() {}
  *(long *minDelay) {}
  
  bool canDoAgain_willDoIfTrue() {
    if (lastTime == 0 || now() >= lastTime+minDelay)
      ret true with lastTime = now();
    false;
  }
  
  bool yo() { ret canDoAgain_willDoIfTrue(); }
  bool get() { ret canDoAgain_willDoIfTrue(); }
}

Author comment

Began life as a copy of #1006309

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: #1015834
Snippet name: NotTooOften
Eternal ID of this version: #1015834/4
Text MD5: 1b92fee48104bbb97c077908ab2c20dd
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-06 10:41:49
Source code size: 348 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 221 / 669
Version history: 3 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1015834 & http://1015834.tinybrain.de