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

21
LINES

< > BotCompany Repo | #1027760 // Fragment - part of a proposition

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

Libraryless. Click here for Pure Java version (100L/1K).

sclass Fragment {
  S text; // should not be null like ever
  transient int hashCode;
  
  *() {}
  *(S text) { this.text = trim(text); }
  
  toString { ret text == null ? "null fragment you bunny" : text; }
  
  public int hashCode() {
    if (hashCode == 0) hashCode = main hashCode(upper(text));
    ret hashCode;
  }
  
  // Note: we have the "turkish" problem (upper <-> eqic)
  public bool equals(O o) {
    // we could allow string here too but that's nasty
    if (!o instanceof Fragment) false;
    ret eqic(text, o/Fragment.text);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027760
Snippet name: Fragment - part of a proposition
Eternal ID of this version: #1027760/6
Text MD5: 9898db06c7b1fb3601a6b2a3c0667b9a
Transpilation MD5: 76755c00e782ab34cb0e3a04088392c2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-16 15:12:41
Source code size: 567 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 257 / 600
Version history: 5 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)