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

28
LINES

< > BotCompany Repo | #1021969 // dm_gazelle_statementsFromAppliedRules_multiSet

JavaX fragment (include)

scope dm_gazelle_statementsFromAppliedRules.

sclass #ByRule {
  S ruleID;
  new MultiSet<S> statements;
}

static MultiSet<S> dm_gazelle_statementsFromAppliedRules_multiSet() {
  L concepts = cloneList((L) dm_requireAndCall("#1021413/AppliedRules", 'concepts));
  new Map<S, ByRule> ruleMap;
  for (O c : concepts) pcall {
    S judgement = getString judgement(c);
    S struct = getString matchedRuleStruct(c);
    RuleEngine2_MatchedRule mr = cast unstructureUnlessContainsAnonymousClasses(struct);
    if (mr == null) continue;
    S ruleID = mr.rule.globalID;
    ByRule r = getOrCreate_f1(ruleMap, ruleID, func(S ruleID) -> ByRule { nu(ByRule, +ruleID) });
    r.statements.addAll(ai_gazelle_statementsFromAppliedRule(mr, judgement));
  }
  //pnlStruct(values(ruleMap));
  new MultiSet<S> out;
  for (ByRule r : values(ruleMap))
    for (S s : keys(r.statements))
      out.add("Rule " + r.ruleID + ": " + s, r.statements.get(s));
  ret out;
}

end scope

Author comment

Began life as a copy of #1021432

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: #1021969
Snippet name: dm_gazelle_statementsFromAppliedRules_multiSet
Eternal ID of this version: #1021969/2
Text MD5: d391d31d723f24641c2efda498136365
Author: stefan
Category: javax / stefan's os / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-04 14:04:20
Source code size: 987 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 258 / 301
Version history: 1 change(s)
Referenced in: [show references]