Libraryless. Click here for Pure Java version (2013L/13K).
1 | sclass Lowest_withRunnerUp<A> extends Lowest<A> {
|
2 | A runnerUp; |
3 | double runnerUpScore; |
4 | |
5 | bool put(A a, double score) {
|
6 | bool change = false; |
7 | synchronized(this) {
|
8 | if (a != null && isNewBest(score)) {
|
9 | runnerUp = best; |
10 | runnerUpScore = this.score; |
11 | best = a; |
12 | this.score = score; |
13 | set change; |
14 | } |
15 | } |
16 | if (change) |
17 | pcallF(onChange); |
18 | ret change; |
19 | } |
20 | |
21 | synchronized Pair<A, Double> runnerUpPair() { ret runnerUp == null ? null : main.pair(runnerUp, runnerUpScore); }
|
22 | } |
Began life as a copy of #1006448
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1024837 |
| Snippet name: | Lowest_withRunnerUp |
| Eternal ID of this version: | #1024837/4 |
| Text MD5: | cdcee0a3e882cd33ab55f8f0d561694b |
| Transpilation MD5: | 9c1f65f1169736f1a9636c024cb47999 |
| Author: | stefan |
| Category: | javax / genetic optimization |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-08-26 19:37:31 |
| Source code size: | 556 bytes / 22 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 470 / 917 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |