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

34
LINES

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

JavaX fragment (include)

sclass ConceptShadow {
  Map map;
  bool refsConvertedToIDs;
  
  *(Concept c) {
    map = conceptShadow_rawMap(c);
    MetaTransformer tf = metaTransformer_collectionAndMap();
    // dereference concept refs
    map = toSortedArrayBasedMap((Map) tf.transform(lambda1 derefRefOrNull, map);
  }
  
  synchronized selfType convertRefsToIDs() {
    if (refsConvertedToIDs) this;
    set refsConvertedToIDs;
    MetaTransformer tf = metaTransformer_collectionAndMap();
    map = toSortedArrayBasedMap(mapValues(map, o -> tf.transform(lambda1 conceptToIDObj_gen, o)));
    this;
  }
  
  toString { ret "ConceptShadow " + stringIf(refsConvertedToIDs, "[converted] ") + map; }
  
  O get(O key) { ret mapGet(map, key); }
  
  public bool equals(O o) {
    if (o cast ConceptShadow) {
      convertRefsToIDs();
      o.convertRefsToIDs();
      ret eq(map, o.map);
    }
    false;
  }
  
  long id() { ret toLong(get("id")); }
}

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: 187 / 206
Referenced in: [show references]