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

22
LINES

< > BotCompany Repo | #1011891 // web_matchTriple_dollarVars - does not handle repeating vars (a == c == "$X")

JavaX fragment (include)

static Pair<WebNode> web_matchTriple_dollarVars(Symbol a, Symbol b, Symbol c, Web web) {
  L<WebNode> nodes = web_nodes(web);
  if (l(nodes) == 1) {
    // check self-relation
    WebNode n = first(nodes);
    if (nodeMatch_dollarVars(b, web_getRelationOpt(n, n)) == 0
      && nodeMatch_dollarVars(a, n) == 0
      && nodeMatch_dollarVars(c, n) == 0)
      ret pair(n);
  } else if (l(nodes) == 2) {
    WebNode n1 = first(nodes), n2 = second(nodes);
    if (nodeMatch_dollarVars(b, web_getRelationOpt(n1, n2)) == 0
      && nodeMatch_dollarVars(a, n1) == 0
      && nodeMatch_dollarVars(c, n2) == 0)
      ret pair(n1, n2);
    if (nodeMatch_dollarVars(b, web_getRelationOpt(n2, n1)) == 0
      && nodeMatch_dollarVars(a, n2) == 0
      && nodeMatch_dollarVars(c, n1) == 0)
      ret pair(n2, n1);
  }
  null;
}

Author comment

Began life as a copy of #1010801

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1011891
Snippet name: web_matchTriple_dollarVars - does not handle repeating vars (a == c == "$X")
Eternal ID of this version: #1011891/9
Text MD5: 669182682e72de1917ba35cab0eef78a
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-10 07:06:47
Source code size: 834 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 420 / 446
Version history: 8 change(s)
Referenced in: [show references]