Libraryless. Click here for Pure Java version (100L/1K).
1 | sclass Fragment { |
2 | S text; // should not be null like ever |
3 | transient int hashCode; |
4 | |
5 | *() {} |
6 | *(S text) { this.text = trim(text); } |
7 | |
8 | toString { ret text == null ? "null fragment you bunny" : text; } |
9 | |
10 | public int hashCode() { |
11 | if (hashCode == 0) hashCode = main hashCode(upper(text)); |
12 | ret hashCode; |
13 | } |
14 | |
15 | // Note: we have the "turkish" problem (upper <-> eqic) |
16 | public bool equals(O o) { |
17 | // we could allow string here too but that's nasty |
18 | if (!o instanceof Fragment) false; |
19 | ret eqic(text, o/Fragment.text); |
20 | } |
21 | } |
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: | 258 / 602 |
Version history: | 5 change(s) |
Referenced in: | [show references] |