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)

1  
sclass TripleWeb extends T3<Symbol> {
2  
  long globalID1;
3  
  short globalID2;
4  
  byte flags;
5  
  
6  
  ifdef TripleWeb_created_compact
7  
  int created_compact; // compact time stamp
8  
  endifdef
9  
  
10  
  ifndef TripleWeb_created_compact
11  
  long created; // full time stamp
12  
  endifndef
13  
  
14  
  //S source;
15  
  
16  
  S source() { null; } // overridable
17  
  O result() { null; } // overridable
18  
  
19  
  static final byte UNVERIFIED = 1;
20  
  
21  
  final GlobalID globalID() { ret globalIDFromParts(globalID1, globalID2); }
22  
  final void globalID(GlobalID id) {
23  
    globalID1 = globalIDPart1(id);
24  
    globalID2 = globalIDPart2(id);
25  
  }
26  
  final void globalID(S id) { globalID(asGlobalID(id)); }
27  
  
28  
  final public int hashCode() { ret (int) globalID1; }
29  
  final public bool equals(O o) {
30  
    ret o instanceof TripleWeb
31  
      && globalID1 == o/TripleWeb.globalID1
32  
      && globalID2 == o/TripleWeb.globalID2;
33  
  }
34  
  
35  
  final bool unverified() { ret (flags & UNVERIFIED) != 0; }
36  
  final bool verified() { ret !unverified(); }
37  
  final void verified(bool v) { flags = v ? 0 : UNVERIFIED; } 
38  
  
39  
  toString {
40  
    ret "[" + globalID() + "] " + super.toString();
41  
  }
42  
  
43  
  ifdef TripleWeb_created_compact
44  
  final long created() { ret fromCompactTimestamp(created_compact); }
45  
  final void created(long created) { created_compact = toCompactTimestamp(created); }
46  
  endifdef
47  
  
48  
  ifndef TripleWeb_created_compact
49  
  final long created() { ret created; }
50  
  final void created(long created) { this.created = created; }
51  
  endifndef
52  
}

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: 592 / 1183
Version history: 20 change(s)
Referenced in: [show references]