Libraryless. Click here for Pure Java version (10115L/55K).
1 | persistable sclass SignalWithStrength { |
2 | settable S type; |
3 | |
4 | settable S reason; |
5 | |
6 | // 0 = no signal, 100 = full signal |
7 | // can be outside of [0; 100] too |
8 | settable double strength; |
9 | |
10 | settable O createdBy; |
11 | |
12 | toString { |
13 | ret (nempty(reason) ? reason : or2(type, "Unspecified ") + " signal") |
14 | + appendRoundBracketed( |
15 | strength >= 100 ? null : iround(strength) + "%" |
16 | ); |
17 | } |
18 | |
19 | bool isTrigger() { ret strength >= 100; } |
20 | bool nonNegative() { ret strength >= 0; } |
21 | bool positive() { ret strength > 0; } |
22 | } |
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1036350 |
Snippet name: | SignalWithStrength |
Eternal ID of this version: | #1036350/12 |
Text MD5: | 731186a6a1b6dc8b1e2759ffbd6df47c |
Transpilation MD5: | 198d3866f2f4c8e9f5134991673d8744 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2023-03-16 17:19:47 |
Source code size: | 558 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 154 / 242 |
Version history: | 11 change(s) |
Referenced in: | [show references] |