Libraryless. Click here for Pure Java version (4033L/23K).
sclass LowestDouble { double best = Double.NaN; transient O onChange; synchronized bool isNewBest(double d) { ret isNaN(best) || d < best; } // may return NaN double get() { ret best; } bool put(double d) { bool change; synchronized(this) { if (isNaN(best) || d < best) { best = d; set change; } } if (change) pcallF(onChange); ret change; } synchronized void clear() { best = Double.NaN; } synchronized bool has() { ret !isNaN(best); } synchronized toString { ret has() ? str(best) : "-"; } }
Began life as a copy of #1006448
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1032639 |
Snippet name: | LowestDouble - records the lowest double |
Eternal ID of this version: | #1032639/3 |
Text MD5: | 2ae3f68491eb9333d0aa6b79a4331295 |
Transpilation MD5: | e4536cd8e5bfdc2b5562d3318438dc29 |
Author: | stefan |
Category: | javax / genetic optimization |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-29 22:59:45 |
Source code size: | 626 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 124 / 241 |
Version history: | 2 change(s) |
Referenced in: | #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |