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

34
LINES

< > BotCompany Repo | #1031096 // ConceptShadow [backup]

JavaX fragment (include)

1  
sclass ConceptShadow {
2  
  Map map;
3  
  bool refsConvertedToIDs;
4  
  
5  
  *(Concept c) {
6  
    map = conceptShadow_rawMap(c);
7  
    MetaTransformer tf = metaTransformer_collectionAndMap();
8  
    // dereference concept refs
9  
    map = toSortedArrayBasedMap((Map) tf.transform(lambda1 derefRefOrNull, map);
10  
  }
11  
  
12  
  synchronized selfType convertRefsToIDs() {
13  
    if (refsConvertedToIDs) this;
14  
    set refsConvertedToIDs;
15  
    MetaTransformer tf = metaTransformer_collectionAndMap();
16  
    map = toSortedArrayBasedMap(mapValues(map, o -> tf.transform(lambda1 conceptToIDObj_gen, o)));
17  
    this;
18  
  }
19  
  
20  
  toString { ret "ConceptShadow " + stringIf(refsConvertedToIDs, "[converted] ") + map; }
21  
  
22  
  O get(O key) { ret mapGet(map, key); }
23  
  
24  
  public bool equals(O o) {
25  
    if (o cast ConceptShadow) {
26  
      convertRefsToIDs();
27  
      o.convertRefsToIDs();
28  
      ret eq(map, o.map);
29  
    }
30  
    false;
31  
  }
32  
  
33  
  long id() { ret toLong(get("id")); }
34  
}

Author comment

Began life as a copy of #1031055

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031096
Snippet name: ConceptShadow [backup]
Eternal ID of this version: #1031096/1
Text MD5: 2881e85897aad7ec85fb41ec94034531
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-01 15:39:13
Source code size: 955 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 188 / 207
Referenced in: [show references]