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

18
LINES

< > BotCompany Repo | #1018889 // YesNoMaybe

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

Libraryless. Click here for Pure Java version (1625L/11K).

1  
sclass YesNoMaybe {
2  
  O value; // null, Bool or Float (0=no, 1=yes)
3  
  S comment;
4  
  
5  
  *() {}
6  
  *(bool *value) {}
7  
  *(Float *value) {}
8  
  
9  
  static YesNoMaybe yes() { ret YesNoMaybe(true); }
10  
  static YesNoMaybe no() { ret YesNoMaybe(false); }
11  
  static YesNoMaybe maybe() { ret YesNoMaybe(0.5f); }
12  
  
13  
  toString {
14  
    if (eqOneOf(value, true, 1f)) ret "yes";
15  
    if (eqOneOf(value, false, 0f)) ret "no";
16  
    ret "maybe" + appendRoundBracketed(comment);
17  
  }
18  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1018889
Snippet name: YesNoMaybe
Eternal ID of this version: #1018889/4
Text MD5: 523985f19f16a79680e6443adec9768f
Transpilation MD5: 72313c54125639abd93a214550f879a4
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-11 16:46:04
Source code size: 472 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 333 / 948
Version history: 3 change(s)
Referenced in: [show references]