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)

1  
static Pair<WebNode> web_matchTriple_dollarVars(Symbol a, Symbol b, Symbol c, Web web) {
2  
  L<WebNode> nodes = web_nodes(web);
3  
  if (l(nodes) == 1) {
4  
    // check self-relation
5  
    WebNode n = first(nodes);
6  
    if (nodeMatch_dollarVars(b, web_getRelationOpt(n, n)) == 0
7  
      && nodeMatch_dollarVars(a, n) == 0
8  
      && nodeMatch_dollarVars(c, n) == 0)
9  
      ret pair(n);
10  
  } else if (l(nodes) == 2) {
11  
    WebNode n1 = first(nodes), n2 = second(nodes);
12  
    if (nodeMatch_dollarVars(b, web_getRelationOpt(n1, n2)) == 0
13  
      && nodeMatch_dollarVars(a, n1) == 0
14  
      && nodeMatch_dollarVars(c, n2) == 0)
15  
      ret pair(n1, n2);
16  
    if (nodeMatch_dollarVars(b, web_getRelationOpt(n2, n1)) == 0
17  
      && nodeMatch_dollarVars(a, n2) == 0
18  
      && nodeMatch_dollarVars(c, n1) == 0)
19  
      ret pair(n2, n1);
20  
  }
21  
  null;
22  
}

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: 491 / 518
Version history: 8 change(s)
Referenced in: [show references]