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

21
LINES

< > BotCompany Repo | #1021801 // gazelle_dropMatchedDefaultRules (and trumped)

JavaX fragment (include)

svoid gazelle_dropMatchedDefaultRules(L<GazelleTree> l, O... _) {
  L<GazelleTree> l2 = filter(l, t -> !eqic(t.lineType, "temporary fact"));
  
  new Set<S> trumpedRules;
  for (GazelleTree t : l2)
    addAll(trumpedRules, matchAll_first("trumps rule *", t.ruleComments()));
    
  L<GazelleTree> trumped = [GazelleTree t : l2 |
       contains(t.ruleComments(), "default")
    || trumpedRules.contains(t.ruleID())];

  if (nempty(trumped) && l(trumped) < l(l2)) {
    if (boolPar debug(_) || boolPar debugDefaults(_)) {
      print("Removing default/trumped rules:");
      printIndentLines(trumped);
      print("Because there are also:");
      printIndentLines(listMinusSet(l2, trumped));
    }
    l.removeAll(trumped);
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1021801
Snippet name: gazelle_dropMatchedDefaultRules (and trumped)
Eternal ID of this version: #1021801/10
Text MD5: 248dbe6a5b448e791037f31b8ad2b51e
Author: stefan
Category: javax / gazelle
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-12 11:25:30
Source code size: 750 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 314 / 359
Version history: 9 change(s)
Referenced in: [show references]