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

14
LINES

< > BotCompany Repo | #1005510 // conceptFromMatches

JavaX fragment (include)

1  
static Concept conceptFromMatches(Class<? extends Concept> cClass, Matches m) {
2  
  Concept c = cnew(cClass);
3  
  S order = toStringOpt(getOpt(cClass, "_fieldOrder"));
4  
  L<S> fields;
5  
  if (order != null)
6  
    fields = splitAtSpace(order);
7  
  else
8  
    fields = asList(asTreeSet(conceptFields(c)));
9  
  if (l(fields) != l(m.m))
10  
    fail(struct(fields) + " / " + struct(m.m));
11  
  for i over fields:
12  
    cset(c, fields.get(i), parseToOptions(m.unq(i)));
13  
  ret c;
14  
}

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: #1005510
Snippet name: conceptFromMatches
Eternal ID of this version: #1005510/1
Text MD5: 628d111b2a14883d7602f6621cc93bcc
Author: stefan
Category: javax / concepts / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-11-24 00:25:20
Source code size: 466 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 563 / 576
Referenced in: [show references]