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

23
LINES

< > BotCompany Repo | #1022337 // gazelle_splitMultiRule - TODO: better ordering in deployed list

JavaX fragment (include)

1  
svoid gazelle_splitMultiRule(S ruleID) {
2  
  PairS p = dm_textAndCommentForRule(ruleID);
3  
  if (p == null || !cic(p.b, "multi-rule")) ret;
4  
  LPair<S> lines = ai_findDoubleArrowRulesAsPairs(p.a);
5  
  S extractedComment = "extracted from multi-rule " + ruleID;
6  
  L<T3S> rules = dm_gazelle_allRulesWithComment(extractedComment);
7  
  LS allComments = withoutStartingWithIC(tlft(p.b), "deployed as rule ");
8  
  S commentsForDeployed = lines_rtrim(listPlus(listMinus(allComments, "multi-rule"), extractedComment));
9  
  Set<S> textsNeeded = asSet(mapPairsToList gazelle_constructRuleText(lines));
10  
  new LS deployed;
11  
  for (T3S t : rules)
12  
    if (!textsNeeded.remove(t.a))
13  
      gazelle_deleteRule(t.c);
14  
    else {
15  
      gazelle_setRuleComment(t.c, commentsForDeployed);
16  
      deployed.add(t.c);
17  
    }
18  
  for (S text : textsNeeded)
19  
    deployed.add(dm_gazelle_addRuleWithComment(text, commentsForDeployed).a);
20  
  for (S deployedID : deployed)
21  
    allComments.add("deployed as rule " + deployedID);
22  
  gazelle_setRuleComment(ruleID, allComments);
23  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1022337
Snippet name: gazelle_splitMultiRule - TODO: better ordering in deployed list
Eternal ID of this version: #1022337/13
Text MD5: 2536a3f4d0d561e02f93654123709cef
Author: stefan
Category: javax / gazelle
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-17 11:11:36
Source code size: 1047 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 260 / 343
Version history: 12 change(s)
Referenced in: [show references]