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)

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

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: 372 / 405
Referenced in: [show references]