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

52
LINES

< > BotCompany Repo | #1012313 // TripleWeb - string triple with meta information (globalID, created, source); equals/hashCode over global ID

JavaX fragment (include)

sclass TripleWeb extends T3<Symbol> {
  long globalID1;
  short globalID2;
  byte flags;
  
  ifdef TripleWeb_created_compact
  int created_compact; // compact time stamp
  endifdef
  
  ifndef TripleWeb_created_compact
  long created; // full time stamp
  endifndef
  
  //S source;
  
  S source() { null; } // overridable
  O result() { null; } // overridable
  
  static final byte UNVERIFIED = 1;
  
  final GlobalID globalID() { ret globalIDFromParts(globalID1, globalID2); }
  final void globalID(GlobalID id) {
    globalID1 = globalIDPart1(id);
    globalID2 = globalIDPart2(id);
  }
  final void globalID(S id) { globalID(asGlobalID(id)); }
  
  final public int hashCode() { ret (int) globalID1; }
  final public bool equals(O o) {
    ret o instanceof TripleWeb
      && globalID1 == o/TripleWeb.globalID1
      && globalID2 == o/TripleWeb.globalID2;
  }
  
  final bool unverified() { ret (flags & UNVERIFIED) != 0; }
  final bool verified() { ret !unverified(); }
  final void verified(bool v) { flags = v ? 0 : UNVERIFIED; } 
  
  toString {
    ret "[" + globalID() + "] " + super.toString();
  }
  
  ifdef TripleWeb_created_compact
  final long created() { ret fromCompactTimestamp(created_compact); }
  final void created(long created) { created_compact = toCompactTimestamp(created); }
  endifdef
  
  ifndef TripleWeb_created_compact
  final long created() { ret created; }
  final void created(long created) { this.created = created; }
  endifndef
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1012313
Snippet name: TripleWeb - string triple with meta information (globalID, created, source); equals/hashCode over global ID
Eternal ID of this version: #1012313/21
Text MD5: d496f86a02ea176e1aba861a2daf8e3f
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-02-27 11:19:31
Source code size: 1522 bytes / 52 lines
Pitched / IR pitched: No / No
Views / Downloads: 591 / 1181
Version history: 20 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)