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)

static Web web_ifThen(Web inputWeb, Web web) {
  Web patternWeb, Map<WebNode> patternMap = unpair cloneWebWithMap(web);
  web_dropRelationsStartingWith(patternWeb, "Then:");

  Web thenWeb, Map<WebNode> thenMap = unpair cloneWebWithReverseMap(web);
  web_unpackRelationsStartingWith(thenWeb, "Then:");
  
  Map<WebNode> match = web_matchAllPerms_partial(patternWeb, inputWeb);
  
  if (match != null) {
    // Then add relations from thenWeb
    for (WebRelation rel : web_relationObjects(thenWeb)) {
      WebNode a = mapGet(match, mapGet(patternMap, mapGet(thenMap, rel.a));
      WebNode b = mapGet(match, mapGet(patternMap, mapGet(thenMap, rel.b));
      if (a != null && b != null) {
        WebRelation rel2 = inputWeb.getRelation(a, b);
        web_addLabelsFromNodeToNode(rel, rel2);
      }
    }
  }
  
  ret inputWeb;
}

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: 513 / 490
Version history: 6 change(s)
Referenced in: [show references]