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

27
LINES

< > BotCompany Repo | #1022466 // gazelle_addDerivedRules

JavaX fragment (include)

1  
svoid gazelle_addDerivedRules(S ruleID, Set<S> transformedTexts, S extractedComment, S comments) {
2  
  LS allComments = tlft(comments);
3  
  gazelle_addDerivedRules(ruleID, transformedTexts, extractedComment, "", allComments, allComments);
4  
}
5  
6  
svoid gazelle_addDerivedRules(S ruleID, Set<S> transformedTexts, S extractedComment, S deployedPrefix, LS allComments, LS coreComments) {
7  
  Set<S> textsNeeded = cloneSet(transformedTexts);
8  
  L<T3S> rules = dm_gazelle_allRulesWithComment(extractedComment);
9  
  LS coreComments2 = empty(deployedPrefix) ? coreComments : withoutStartingWithIC(coreComments, deployedPrefix);
10  
  S commentsForDeployed = lines_rtrim(listPlus(coreComments2, extractedComment));
11  
  new LS deployed;
12  
  for (T3S t : rules)
13  
    if (!textsNeeded.remove(t.a))
14  
      gazelle_deleteRule(t.c);
15  
    else {
16  
      gazelle_setRuleComment(t.c, commentsForDeployed);
17  
      deployed.add(t.c);
18  
    }
19  
  for (S text : textsNeeded)
20  
    deployed.add(dm_gazelle_addRuleWithComment(text, commentsForDeployed).a);
21  
  if (nempty(deployedPrefix)) {
22  
    LS allComments2 = withoutStartingWithIC(allComments, deployedPrefix);
23  
    for (S deployedID : deployed)
24  
      allComments2.add(deployedPrefix + deployedID);
25  
    gazelle_setRuleComment(ruleID, allComments2);
26  
  }
27  
}

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: 236 / 280
Version history: 5 change(s)
Referenced in: [show references]