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

28
LINES

< > BotCompany Repo | #1017815 // nlLogic_visit - visit rules and expressions

JavaX fragment (include)

svoid nlLogic_visit(IfThen rule, VF1<O> visitor) {
  if (rule == null) ret;
  callF(visitor, rule);
  nlLogic_visit(rule.in, visitor);
  nlLogic_visit(rule.out, visitor);
}

svoid nlLogic_visit(Exp e, VF1<O> visitor) {
  if (e == null) ret;
  callF(visitor, e);
  if (e cast And) {
    nlLogic_visit(e.a, visitor);
    nlLogic_visit(e.b, visitor);
  } else if (e cast ExpNot)
    nlLogic_visit(e.a, visitor);
  else if (e cast Func)
    nlLogic_visit(e.arg, visitor);
}

svoid nlLogic_visit(Collection l, VF1<O> visitor) {
  for (O o : unnull(l)) nlLogic_visit(o, visitor);
}

svoid nlLogic_visit(O o, VF1<O> visitor) {
  if (o cast Exp) nlLogic_visit(o, visitor);
  if (o cast IfThen) nlLogic_visit(o, visitor);
  if (o cast Collection) nlLogic_visit(o, visitor);
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017815
Snippet name: nlLogic_visit - visit rules and expressions
Eternal ID of this version: #1017815/8
Text MD5: 757c9f0de22ca9307569cba33a0ee460
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-06 11:33:37
Source code size: 793 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 471 / 489
Version history: 7 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1017880 - nlLogic_visitShallow - doesn't go inside Func
#1018005 - nlLogic_visitWithParent