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

21
LINES

< > BotCompany Repo | #1010464 // web_ifThen_full - modifies inputWeb - full match only

JavaX fragment (include)

static Web web_ifThen_full(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(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 = resultWeb.getRelation(a, b);
        web_addLabelsFromNodeToNode(rel, rel2);
      }
    }
  }
}

Author comment

Began life as a copy of #1010463

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: #1010464
Snippet name: web_ifThen_full - modifies inputWeb - full match only
Eternal ID of this version: #1010464/1
Text MD5: 14be7dab5ef535eb20954d2d02f23c2f
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:18:18
Source code size: 831 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 460 / 490
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)