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

22
LINES

< > BotCompany Repo | #1036350 // SignalWithStrength

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (9976L/55K).

persistable sclass SignalWithStrength {
  settable S type;
  
  settable S reason;
  
  // 0 = no signal, 100 = full signal
  // can be outside of [0; 100] too
  settable double strength;
  
  settable O createdBy;
  
  toString {
    ret or2(type, "Unspecified ") + " signal "
      + appendRoundBracketed(
        commaCombine(reason, iround(strength) + "%")
      );
  }
  
  bool isTrigger() { ret strength >= 100; }
  bool nonNegative() { ret strength >= 0; }
  bool positive() { ret strength > 0; }
}

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/8
Text MD5: 595797d479ed0a264ab42c6b47147b4a
Transpilation MD5: 5867013952da1a51d88348b3c06b30f8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-05 21:30:06
Source code size: 527 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 18 / 54
Version history: 7 change(s)
Referenced in: [show references]