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).

static Concept cnew(S name, O... values) {
  ret cnew(db_mainConcepts(), name, values);
}

static Concept cnew(Concepts concepts, S name, O... values) {
  Class<? extends Concept> cc = findClass(name);
  concepts_unlisted.set(true);
  Concept c;
  try {
    c = cc != null ? nuObject(cc) : new Concept(name);
  } finally {
    concepts_unlisted.set(null);
  }
  csetAll(c, values);
  concepts.register(c);
  ret c;
}

static <A extends Concept> A nuLike cnew(Class<A> cc, O... values) {
  ret cnew(db_mainConcepts(), cc, values);
}

static <A extends Concept> A cnew(Concepts concepts, Class<A> cc, O... values) {
  concepts_unlisted.set(true);
  A c;
  try {
    c = nuObject(cc);
  } finally {
    concepts_unlisted.set(null);
  }
  csetAll(c, values);
  concepts.register(c);
  ret c;
}

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: 554 / 644
Version history: 12 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)