scope ai_gazelle_analyzeStatementsForRule. sclass #Data { MultiSet<S> statements; Set<S> possibleVars, usedVars, unusedVars, varsUsedInGood, varsUsedInBad, varsUsedInGoodOnly, varsUsedInBadOnly; Set<S> unclearVars; // used in good and bad mappings MultiMap<S> goodMappings, badMappings, // per var alwaysGoodMappings, alwaysBadMappings; L<SS> completeGoodMappings, completeBadMappings; Map<PairS, PosNegScore> varScores; } static Data ai_gazelle_analyzeStatementsForRule(Collection<S> l) { Set<S> possibleVars = asCISet(matchAny_firstGroups("possible variable *", l)); Set<S> usedVars = asCISet(matchX_any_firstGroups("... variable * was used", l)); Set<S> unusedVars = asCISet(listMinusSet(possibleVars, usedVars)); Set<S> varsUsedInGood = asCISet(matchX_any_firstGroups("in a good mapping, variable * was used", l)); Set<S> varsUsedInBad = asCISet(matchX_any_firstGroups("in a bad mapping, variable * was used", l)); Set<S> unclearVars = setIntersection(varsUsedInGood, varsUsedInBad); MultiMap<S> goodMappings = uniquifyMultiMapValues(pairsToMultiMap(matchX_any_firstAndSecondGroups("in a good mapping, variable * was mapped to *", l))); MultiMap<S> badMappings = uniquifyMultiMapValues(pairsToMultiMap(matchX_any_firstAndSecondGroups("in a bad mapping, variable * was mapped to *", l))); MultiMap<S> alwaysGoodMappings = multiMapDiff(goodMappings, badMappings); MultiMap<S> alwaysBadMappings = multiMapDiff(badMappings, goodMappings); L<SS> completeGoodMappings = (L) map safeUnstruct(matchX_any_firstGroups("a good mapping is *", l)); L<SS> completeBadMappings = (L) map safeUnstruct(matchX_any_firstGroups("a bad mapping is *", l)); ret nu(Data, +possibleVars, +usedVars, +unusedVars, +varsUsedInGood, +varsUsedInBad, +unclearVars, varsUsedInGoodOnly := setDiff(varsUsedInGood, varsUsedInBad), varsUsedInBadOnly := setDiff(varsUsedInBad, varsUsedInGood), +goodMappings, +badMappings, +alwaysGoodMappings, +alwaysBadMappings, +completeGoodMappings, +completeBadMappings); } end scope
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney
No comments. add comment
Snippet ID: | #1021439 |
Snippet name: | ai_gazelle_analyzeStatementsForRule |
Eternal ID of this version: | #1021439/13 |
Text MD5: | 3695b9fe32664e22c247874ae4fd0ed2 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-06-29 21:42:44 |
Source code size: | 2105 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 388 / 893 |
Version history: | 12 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1021970 - ai_gazelle_analyzeStatementsForRule_multiSet #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |