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

32
LINES

< > BotCompany Repo | #1033193 // metaMapPut - backup

JavaX fragment (include)

svoid metaMapPut(IMeta o, O key, O value) {
  if (o == null || key == null) ret;
  Map map = convertObjectMetaToMap(o);
  syncMapPutOrRemove(map, key, value);
}

// untested...
/*svoid metaMapPut(IMeta o, O key, O value, IMapImplementationPolicy policy) {
  if (o == null || key == null) ret;
  if (policy == null) ret with metaMapPut(o, key, value);
  
  // no shortcuts in this function, always get mutex & lock
  temp var mutex = tempMetaMutex(o);
  synchronized(mutex!) {
    O meta = o._getMeta();
    
    // create map if necessary
    Map map = null;
    if (meta cast Map)
      map = meta;
    else if (meta != null)
      map = policy.put(map, previousMeta := meta);
      
    // putOrRemove through policy
    if (value != null)
      map = policy.put(map, key, value);
    else
      map = policy.remove(map, key);
      
    if (map != meta) o._setMeta(map);
  }
}*/

Author comment

Began life as a copy of #1031852

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

-
Snippet ID: #1033193
Snippet name: metaMapPut - backup
Eternal ID of this version: #1033193/5
Text MD5: cea3f5fa43fa486679227dcd80044533
Author: stefan
Category: javax / reasoning
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-16 01:09:24
Source code size: 914 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 168 / 186
Version history: 4 change(s)
Referenced in: