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

32
LINES

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

JavaX fragment (include)

1  
svoid metaMapPut(IMeta o, O key, O value) {
2  
  if (o == null || key == null) ret;
3  
  Map map = convertObjectMetaToMap(o);
4  
  syncMapPutOrRemove(map, key, value);
5  
}
6  
7  
// untested...
8  
/*svoid metaMapPut(IMeta o, O key, O value, IMapImplementationPolicy policy) {
9  
  if (o == null || key == null) ret;
10  
  if (policy == null) ret with metaMapPut(o, key, value);
11  
  
12  
  // no shortcuts in this function, always get mutex & lock
13  
  temp var mutex = tempMetaMutex(o);
14  
  synchronized(mutex!) {
15  
    O meta = o._getMeta();
16  
    
17  
    // create map if necessary
18  
    Map map = null;
19  
    if (meta cast Map)
20  
      map = meta;
21  
    else if (meta != null)
22  
      map = policy.put(map, previousMeta := meta);
23  
      
24  
    // putOrRemove through policy
25  
    if (value != null)
26  
      map = policy.put(map, key, value);
27  
    else
28  
      map = policy.remove(map, key);
29  
      
30  
    if (map != meta) o._setMeta(map);
31  
  }
32  
}*/

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: 169 / 187
Version history: 4 change(s)
Referenced in: [show references]