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

23
LINES

< > BotCompany Repo | #1010463 // web_ifThen - modifies inputWeb

JavaX fragment (include)

1  
static Web web_ifThen(Web inputWeb, Web web) {
2  
  Web patternWeb, Map<WebNode> patternMap = unpair cloneWebWithMap(web);
3  
  web_dropRelationsStartingWith(patternWeb, "Then:");
4  
5  
  Web thenWeb, Map<WebNode> thenMap = unpair cloneWebWithReverseMap(web);
6  
  web_unpackRelationsStartingWith(thenWeb, "Then:");
7  
  
8  
  Map<WebNode> match = web_matchAllPerms_partial(patternWeb, inputWeb);
9  
  
10  
  if (match != null) {
11  
    // Then add relations from thenWeb
12  
    for (WebRelation rel : web_relationObjects(thenWeb)) {
13  
      WebNode a = mapGet(match, mapGet(patternMap, mapGet(thenMap, rel.a));
14  
      WebNode b = mapGet(match, mapGet(patternMap, mapGet(thenMap, rel.b));
15  
      if (a != null && b != null) {
16  
        WebRelation rel2 = inputWeb.getRelation(a, b);
17  
        web_addLabelsFromNodeToNode(rel, rel2);
18  
      }
19  
    }
20  
  }
21  
  
22  
  ret inputWeb;
23  
}

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: #1010463
Snippet name: web_ifThen - modifies inputWeb
Eternal ID of this version: #1010463/7
Text MD5: 19f396f51bfe3df70b3b13bc6092e79e
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-18 02:58:58
Source code size: 852 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 428 / 413
Version history: 6 change(s)
Referenced in: [show references]