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

22
LINES

< > BotCompany Repo | #1012685 // class Symbol - a string comparable with "==" [v1]

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

Transpiled version (55L) is out of date.

// for the version with MasterSymbol (used WAY back in "Smart Bot"!) see #1010608

sclass Symbol implements CharSequence {
  S text;
  
  *() {}
  *(S *text, bool dummy) {} // weird signature to prevent accidental calling
  
  public int hashCode() { ret _hashCode(text); }
  toString { ret text; }
  public bool equals(O o) {
    ret this == o;
  }

  // implementation of CharSequence methods
  
  public int length() { ret text.length(); }
  public char charAt(int index) { ret text.charAt(index); }
  public CharSequence subSequence(int start, int end) {
    ret text.substring(start, end);
  }
}

Author comment

Began life as a copy of #1010608

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1012685
Snippet name: class Symbol - a string comparable with "==" [v1]
Eternal ID of this version: #1012685/9
Text MD5: e78354184bfab2644253f4e078f213eb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-23 05:27:45
Source code size: 621 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 481 / 547
Version history: 8 change(s)
Referenced in: [show references]