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)

svoid gazelle_splitMultiRule(S ruleID) {
  PairS p = dm_textAndCommentForRule(ruleID);
  if (p == null || !cic(p.b, "multi-rule")) ret;
  LPair<S> lines = ai_findDoubleArrowRulesAsPairs(p.a);
  S extractedComment = "extracted from multi-rule " + ruleID;
  L<T3S> rules = dm_gazelle_allRulesWithComment(extractedComment);
  LS allComments = withoutStartingWithIC(tlft(p.b), "deployed as rule ");
  S commentsForDeployed = lines_rtrim(listPlus(listMinus(allComments, "multi-rule"), extractedComment));
  Set<S> textsNeeded = asSet(mapPairsToList gazelle_constructRuleText(lines));
  new LS deployed;
  for (T3S t : rules)
    if (!textsNeeded.remove(t.a))
      gazelle_deleteRule(t.c);
    else {
      gazelle_setRuleComment(t.c, commentsForDeployed);
      deployed.add(t.c);
    }
  for (S text : textsNeeded)
    deployed.add(dm_gazelle_addRuleWithComment(text, commentsForDeployed).a);
  for (S deployedID : deployed)
    allComments.add("deployed as rule " + deployedID);
  gazelle_setRuleComment(ruleID, allComments);
}

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: 259 / 342
Version history: 12 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1022430 - gazelle_splitMultiRule_v2 (should have same functionality)