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

22
LINES

< > BotCompany Repo | #1005040 // uniqueConcept - now with db lock

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (15592L/100K).

1  
static <A extends Concept> A uniqueConcept(Class<A> c, O... params) {
2  
  ret uniqueConcept(db_mainConcepts(), c, params);
3  
}
4  
5  
static <A extends Concept> A uniqueConcept(Concepts cc, Class<A> c, O... params) {
6  
  temp tempDBLock(cc);
7  
  params = expandParams(c, params);
8  
  A x = findConceptWhere(cc, c, params);
9  
  if (x == null) {
10  
    x = unlisted(c);
11  
    ifdef uniqueConcept_debug
12  
      printStackTrace(renderVars_str uniqueConcept_debug(action := "Made unlisted", +cc, +c, +params, +x));
13  
    endifdef
14  
    csetAll(x, params);
15  
    cc.register(x);
16  
  } else {
17  
    ifdef uniqueConcept_debug
18  
      printStackTrace(renderVars_str printVars_str uniqueConcept_debug(action := "Found existing", +cc, +c, +params, +x));
19  
    endifdef
20  
  }
21  
  ret x;
22  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005040
Snippet name: uniqueConcept - now with db lock
Eternal ID of this version: #1005040/12
Text MD5: a0272c3ac004a0f151c2df90f08b82f5
Transpilation MD5: d86d0cdf3fba8f53afca4c8890cc0904
Author: stefan
Category: javax / concepts
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-18 16:28:28
Source code size: 754 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 706 / 793
Version history: 11 change(s)
Referenced in: [show references]