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

36
LINES

< > BotCompany Repo | #1028753 // nla_partialMappingsWithFailures

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (4043L) is out of date.

1  
sclass NLAMappedProp {
2  
  L proposition;
3  
  NLABlock.Line metBy;
4  
  
5  
  toString {
6  
    ret "prop (" + renderFragments(proposition) + ") "
7  
      + (metBy == null ? "unmet" : "met by (" + renderFragments(metBy.proposition) + ")");
8  
  }
9  
}
10  
11  
sclass NLAMapping {
12  
  NLABlock src, dest;
13  
  Map<NLABlock.Entity> entityMap;
14  
  Map<NLABlock.Line, NLAMappedProp> propositionMap;
15  
}
16  
17  
static L<NLAMapping> nla_partialMappingsWithFailures(NLABlock b1, NLABlock b2) {
18  
  Map<L, NLABlock.Line> propsB = b2.propositionIndex();
19  
20  
  new L<NLAMapping> out;
21  
  loop: for (Map<NLABlock.Entity> map : nla_allPossibleMappings(b1, b2)) {
22  
    new NLAMapping mapping;
23  
    mapping.src = b1;
24  
    mapping.dest = b2;
25  
    mapping.entityMap = map;
26  
    mapping.propositionMap = new Map;
27  
    for (NLABlock.Line line : b1.propositionLines()) {
28  
      new NLAMappedProp mp;
29  
      mp.proposition = nla_translateLine(line, map);
30  
      mp.metBy = propsB.get(mp.proposition);
31  
      mapping.propositionMap.put(line, mp);
32  
    }
33  
    out.add(mapping);
34  
  }
35  
  ret out;
36  
}

Author comment

Began life as a copy of #1028747

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028753
Snippet name: nla_partialMappingsWithFailures
Eternal ID of this version: #1028753/6
Text MD5: 75180ee5186b5ea11933e5c10f8c1eb8
Author: stefan
Category: javax / nla
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-07 00:32:07
Source code size: 1045 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 229 / 323
Version history: 5 change(s)
Referenced in: [show references]