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.

sclass NLAMappedProp {
  L proposition;
  NLABlock.Line metBy;
  
  toString {
    ret "prop (" + renderFragments(proposition) + ") "
      + (metBy == null ? "unmet" : "met by (" + renderFragments(metBy.proposition) + ")");
  }
}

sclass NLAMapping {
  NLABlock src, dest;
  Map<NLABlock.Entity> entityMap;
  Map<NLABlock.Line, NLAMappedProp> propositionMap;
}

static L<NLAMapping> nla_partialMappingsWithFailures(NLABlock b1, NLABlock b2) {
  Map<L, NLABlock.Line> propsB = b2.propositionIndex();

  new L<NLAMapping> out;
  loop: for (Map<NLABlock.Entity> map : nla_allPossibleMappings(b1, b2)) {
    new NLAMapping mapping;
    mapping.src = b1;
    mapping.dest = b2;
    mapping.entityMap = map;
    mapping.propositionMap = new Map;
    for (NLABlock.Line line : b1.propositionLines()) {
      new NLAMappedProp mp;
      mp.proposition = nla_translateLine(line, map);
      mp.metBy = propsB.get(mp.proposition);
      mapping.propositionMap.put(line, mp);
    }
    out.add(mapping);
  }
  ret out;
}

Author comment

Began life as a copy of #1028747

download  show line numbers  debug dex   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, 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: 48 / 90
Version history: 5 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1028753 & http://1028753.tinybrain.de