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

41
LINES

< > BotCompany Repo | #1021761 // Gazelle Fakery Include [for test cases]

JavaX fragment (include)

1  
static new L<T3<S>> rules; // text, comment, ID
2  
static new L<GazelleFulfillment> fulfillments;
3  
static new LinkedHashSet<S> temporaryFacts;
4  
5  
static L<T3<S>> dm_allRulesFromRulesModuleWithCommentsAndIDs() {
6  
  ret rules;
7  
}
8  
9  
svoid dm_gazelle_setRuleComments_verbose(S ruleID, S comments) {
10  
  set(objectWhere(rules, c := ruleID), b := comments);
11  
}
12  
13  
static PairS dm_textAndCommentForRule(S ruleID) {
14  
  T3<S> t = objectWhere(rules, c := ruleID);
15  
  ret t == null ? null : pair(t.a, t.b);
16  
}
17  
18  
static Pair<S, Bool> dm_gazelle_addRuleWithComment(S text, S comment) {
19  
  T3<S> t = objectWhere(rules, a := text, b := comment);
20  
  if (t != null) ret pair(t.c, false);
21  
  S id = aGlobalID();
22  
  rules.add(t3(text, comment, id));
23  
  ret pair(id, true);
24  
}
25  
26  
static L dm_gazelle_fulfillmentsForRule(S ruleID) {
27  
  ret objectsWhere(fulfillments, rule := ruleID);
28  
}
29  
30  
static GazelleEvalContext dm_gazelle_stdEvalContext() {
31  
  ret dm_gazelle_stdEvalContext(dm_allRulesFromRulesModuleWithCommentsAndIDs());
32  
}
33  
34  
static GazelleEvalContext dm_gazelle_stdEvalContext(L<T3<S>> rules) {
35  
  ret gazelle_stdEvalContext(rules);
36  
}
37  
38  
sS dm_gazelle_addTempFact(S text) {
39  
  temporaryFacts.add(text);
40  
  ret aGlobalID();
41  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): ayivmpnvhhik, bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021761
Snippet name: Gazelle Fakery Include [for test cases]
Eternal ID of this version: #1021761/4
Text MD5: 610716c64198b1ae4c34732b73359ff1
Author: stefan
Category: javax / gazelle
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-28 09:17:23
Source code size: 1213 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 378 / 2124
Version history: 3 change(s)
Referenced in: [show references]