1 | sclass DoomEstimator { |
2 | long time1, time2; |
3 | double value1, value2; |
4 | double minValue; |
5 | Long doomDate; |
6 | |
7 | *() {} |
8 | *(double *minValue) {} |
9 | |
10 | // returns true if there is enough info for computing a doom date |
11 | bool consumeValue(double value) { |
12 | time1 = time2; |
13 | value1 = value2; |
14 | time2 = sysNow(); |
15 | value2 = value; |
16 | if (time1 == 0) false; |
17 | doomDate = ai_calculateDateOfDoom(time1, value1, time2, value2, minValue); |
18 | true; |
19 | } |
20 | |
21 | bool doomDateReady() { ret time1 != 0; } |
22 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1023146 |
Snippet name: | DoomEstimator - guesses when a value will fall below a threshold |
Eternal ID of this version: | #1023146/5 |
Text MD5: | 167c5029188a516da8b8f5432fdde678 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-05-15 16:07:21 |
Source code size: | 517 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 287 / 699 |
Version history: | 4 change(s) |
Referenced in: | [show references] |