Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
RagConnect
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JastAdd
RagConnect
Merge requests
!33
Resolve "Refactorings/Clean-Up"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Refactorings/Clean-Up"
39-refactorings-clean-up
into
dev
Overview
0
Commits
14
Pipelines
7
Changes
3
Merged
René Schöne
requested to merge
39-refactorings-clean-up
into
dev
2 years ago
Overview
0
Commits
14
Pipelines
7
Changes
3
Expand
Closes
#39 (closed)
Edited
2 years ago
by
René Schöne
0
0
Merge request reports
Viewing commit
84b9e1e2
Prev
Next
Show latest version
3 files
+
285
−
274
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
84b9e1e2
move aspects into separate template file
· 84b9e1e2
René Schöne
authored
2 years ago
- also add method to reset evaluation counter
ragconnect.base/src/main/resources/EvaluationCounter.mustache
0 → 100644
+
105
−
0
Options
aspect EvaluationCounter {
public String ASTNode.
{{
evaluationCounterSummaryMethodName
}}
() {
{{#
configEvaluationCounter
}}
return
{{
evaluationCounterVariable
}}
.summary();
{{/
configEvaluationCounter
}}
{{^
configEvaluationCounter
}}
String message = "Option --evaluationCounter was not set. No Summary available";
{{
logWarn
}}
(message);
return message;
{{/
configEvaluationCounter
}}
}
{{#
configEvaluationCounter
}}
static EvaluationCounter ASTNode.
{{
evaluationCounterVariable
}}
= new EvaluationCounter();
public void
{{
parentTypeName
}}
.ragconnectResetEvaluationCounter() {
{{#
configEvaluationCounter
}}
{{
evaluationCounterVariable
}}
.reset();
{{/
configEvaluationCounter
}}
{{^
configEvaluationCounter
}}
{{
logWarn
}}
("Option --evaluationCounter was not set. Nothing to reset!");
{{/
configEvaluationCounter
}}
}
public class EvaluationCounter {
private java.util.Map
<String
,
java.util.Map
<
String
,
{{
evaluationCounterInnerClass
}}
>
> counters = new java.util.HashMap
<>
();
private final java.util.function.Function
<
?
super
String
,
?
extends
java.util.Map
<
String
,
{{
evaluationCounterInnerClass
}}
>
> parentAbsent = key -> {
return new java.util.HashMap
<>
();
};
private final java.util.function.Function
<
?
super
String
,
?
extends
{{
evaluationCounterInnerClass
}}
>
entityAbsent = key -> {
return new
{{
evaluationCounterInnerClass
}}
();
};
public void incrementReceive(String parentTypeName, String entityName) {
getCounter(parentTypeName, entityName).receive += 1;
}
public void incrementSend(String parentTypeName, String entityName) {
getCounter(parentTypeName, entityName).send += 1;
}
public void incrementCall(String parentTypeName, String entityName) {
getCounter(parentTypeName, entityName).call += 1;
}
public void incrementFirstNull(String parentTypeName, String entityName) {
getCounter(parentTypeName, entityName).firstNull += 1;
}
public void incrementSkip(String parentTypeName, String entityName) {
getCounter(parentTypeName, entityName).skip += 1;
}
public void incrementException(String parentTypeName, String entityName) {
getCounter(parentTypeName, entityName).exception += 1;
}
public void incrementReject(String parentTypeName, String entityName) {
getCounter(parentTypeName, entityName).reject += 1;
}
public String summary() {
StringBuilder sb = new StringBuilder();
// header
sb.append("parentTypeName,entityName,receive,send,call,firstNull,skip,exception,reject").append("\n");
// values
java.util.Set
<String>
sortedParentTypes = new java.util.TreeSet
<>
(counters.keySet());
for (String parentType : sortedParentTypes) {
java.util.Set
<String>
sortedEntityNames = new java.util.TreeSet
<>
(counters.get(parentType).keySet());
for (String entityName : sortedEntityNames) {
{{
evaluationCounterInnerClass
}}
count = getCounter(parentType, entityName);
java.util.StringJoiner sj = new java.util.StringJoiner(",", "", "\n");
sj.add(parentType)
.add(entityName)
.add(Integer.toString(count.receive))
.add(Integer.toString(count.send))
.add(Integer.toString(count.call))
.add(Integer.toString(count.firstNull))
.add(Integer.toString(count.skip))
.add(Integer.toString(count.exception))
.add(Integer.toString(count.reject))
;
sb.append(sj);
}
}
return sb.toString();
}
private
{{
evaluationCounterInnerClass
}}
getCounter(String parentTypeName, String entityName) {
return counters.computeIfAbsent(parentTypeName, parentAbsent).computeIfAbsent(entityName, entityAbsent);
}
public void reset() {
counters = new java.util.HashMap
<>
();
}
}
class
{{
evaluationCounterInnerClass
}}
{
int receive = 0;
int send = 0;
int call = 0;
int firstNull = 0;
int skip = 0;
int exception = 0;
int reject = 0;
}
{{/
configEvaluationCounter
}}
}
Loading