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

34
LINES

< > BotCompany Repo | #1007592 // cnew - make new concept & register. takes value params (not constructor args)

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

Libraryless. Click here for Pure Java version (17470L/106K).

1  
static Concept cnew(S name, O... values) {
2  
  ret cnew(db_mainConcepts(), name, values);
3  
}
4  
5  
static Concept cnew(Concepts concepts, S name, O... values) {
6  
  Class<? extends Concept> cc = findClass(name);
7  
  concepts_unlisted.set(true);
8  
  Concept c;
9  
  try {
10  
    c = cc != null ? nuObject(cc) : new Concept(name);
11  
  } finally {
12  
    concepts_unlisted.set(null);
13  
  }
14  
  csetAll(c, values);
15  
  concepts.register(c);
16  
  ret c;
17  
}
18  
19  
static <A extends Concept> A nuLike cnew(Class<A> cc, O... values) {
20  
  ret cnew(db_mainConcepts(), cc, values);
21  
}
22  
23  
static <A extends Concept> A cnew(Concepts concepts, Class<A> cc, O... values) {
24  
  concepts_unlisted.set(true);
25  
  A c;
26  
  try {
27  
    c = nuObject(cc);
28  
  } finally {
29  
    concepts_unlisted.set(null);
30  
  }
31  
  csetAll(c, values);
32  
  concepts.register(c);
33  
  ret c;
34  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007592
Snippet name: cnew - make new concept & register. takes value params (not constructor args)
Eternal ID of this version: #1007592/13
Text MD5: ac4acaac5d4842f17d560c52f982fef5
Transpilation MD5: e29d8a64657ac47535cfd3394381b9a1
Author: stefan
Category: javax / concepts
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-15 16:29:57
Source code size: 824 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 555 / 645
Version history: 12 change(s)
Referenced in: [show references]