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).

sclass YesNoMaybe {
  O value; // null, Bool or Float (0=no, 1=yes)
  S comment;
  
  *() {}
  *(bool *value) {}
  *(Float *value) {}
  
  static YesNoMaybe yes() { ret YesNoMaybe(true); }
  static YesNoMaybe no() { ret YesNoMaybe(false); }
  static YesNoMaybe maybe() { ret YesNoMaybe(0.5f); }
  
  toString {
    if (eqOneOf(value, true, 1f)) ret "yes";
    if (eqOneOf(value, false, 0f)) ret "no";
    ret "maybe" + appendRoundBracketed(comment);
  }
}

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: 332 / 947
Version history: 3 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)