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

29
LINES

< > BotCompany Repo | #1022430 // gazelle_splitMultiRule_v2 (should have same functionality)

JavaX fragment (include)

svoid gazelle_splitMultiRule_v2(S ruleID) {
  PairS p = dm_textAndCommentForRule(ruleID);
  if (p == null || !cic(p.b, "multi-rule")) ret;
  
  LPair<S> lines = ai_findDoubleArrowRulesAsPairs(p.a);
  Set<S> textsNeeded = asSet(mapPairsToList gazelle_constructRuleText(lines));
  S extractedComment = "extracted from multi-rule " + ruleID;
  S deployedPrefix = "deployed as rule ";
  LS allComments = tlft(p.b);
  LS coreComments = listWithoutIC(allComments, "multi-rule");
  
  L<T3S> rules = dm_gazelle_allRulesWithComment(extractedComment);
  LS coreComments2 = withoutStartingWithIC(coreComments, deployedPrefix);
  S commentsForDeployed = lines_rtrim(listPlus(coreComments2, extractedComment));
  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);
  LS allComments2 = withoutStartingWithIC(allComments, deployedPrefix);
  for (S deployedID : deployed)
    allComments2.add(deployedPrefix + deployedID);
  gazelle_setRuleComment(ruleID, allComments2);
}

Author comment

Began life as a copy of #1022337

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: #1022430
Snippet name: gazelle_splitMultiRule_v2 (should have same functionality)
Eternal ID of this version: #1022430/5
Text MD5: 665542796d6159b74b4d4dc32a2a31d1
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:12:54
Source code size: 1242 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 274 / 282
Version history: 4 change(s)
Referenced in: [show references]