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

27
LINES

< > BotCompany Repo | #1022466 // gazelle_addDerivedRules

JavaX fragment (include)

svoid gazelle_addDerivedRules(S ruleID, Set<S> transformedTexts, S extractedComment, S comments) {
  LS allComments = tlft(comments);
  gazelle_addDerivedRules(ruleID, transformedTexts, extractedComment, "", allComments, allComments);
}

svoid gazelle_addDerivedRules(S ruleID, Set<S> transformedTexts, S extractedComment, S deployedPrefix, LS allComments, LS coreComments) {
  Set<S> textsNeeded = cloneSet(transformedTexts);
  L<T3S> rules = dm_gazelle_allRulesWithComment(extractedComment);
  LS coreComments2 = empty(deployedPrefix) ? coreComments : 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);
  if (nempty(deployedPrefix)) {
    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 #1022432

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: #1022466
Snippet name: gazelle_addDerivedRules
Eternal ID of this version: #1022466/6
Text MD5: b13db600edcf7cf5260ad0291b9a0acc
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 22:19:31
Source code size: 1274 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 234 / 278
Version history: 5 change(s)
Referenced in: [show references]