diff options
author | 2021-10-02 20:51:58 +0200 | |
---|---|---|
committer | 2021-10-02 20:51:58 +0200 | |
commit | 9b8236dd7499510577c32f0d87dfd52d34f6b023 (patch) | |
tree | d9e35fa5692e3b08d0bcf1fbbd538c65ed4b58e1 /store/src/main/java/org/eclipse/viatra/solver/data/query/building/RelationAtom.java | |
parent | build: simplify Eclipse project generation (diff) | |
download | refinery-9b8236dd7499510577c32f0d87dfd52d34f6b023.tar.gz refinery-9b8236dd7499510577c32f0d87dfd52d34f6b023.tar.zst refinery-9b8236dd7499510577c32f0d87dfd52d34f6b023.zip |
chore: fix Java 17 Sonar warnings
Had to disable code coverage measurement in the Quality Gate, we should
switch it on again once we have a complete test suite.
Diffstat (limited to 'store/src/main/java/org/eclipse/viatra/solver/data/query/building/RelationAtom.java')
-rw-r--r-- | store/src/main/java/org/eclipse/viatra/solver/data/query/building/RelationAtom.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/store/src/main/java/org/eclipse/viatra/solver/data/query/building/RelationAtom.java b/store/src/main/java/org/eclipse/viatra/solver/data/query/building/RelationAtom.java index f7152bba..adf2f8c7 100644 --- a/store/src/main/java/org/eclipse/viatra/solver/data/query/building/RelationAtom.java +++ b/store/src/main/java/org/eclipse/viatra/solver/data/query/building/RelationAtom.java | |||
@@ -7,37 +7,41 @@ import java.util.Set; | |||
7 | import org.eclipse.viatra.solver.data.query.view.FilteredRelationView; | 7 | import org.eclipse.viatra.solver.data.query.view.FilteredRelationView; |
8 | import org.eclipse.viatra.solver.data.query.view.RelationView; | 8 | import org.eclipse.viatra.solver.data.query.view.RelationView; |
9 | 9 | ||
10 | public class RelationAtom implements DNFAtom{ | 10 | public class RelationAtom implements DNFAtom { |
11 | RelationView<?> view; | 11 | RelationView<?> view; |
12 | List<Variable> substitution; | 12 | List<Variable> substitution; |
13 | 13 | ||
14 | public RelationAtom(RelationView<?> view, List<Variable> substitution) { | 14 | public RelationAtom(RelationView<?> view, List<Variable> substitution) { |
15 | this.view = view; | 15 | this.view = view; |
16 | this.substitution = substitution; | 16 | this.substitution = substitution; |
17 | } | 17 | } |
18 | |||
18 | public RelationView<?> getView() { | 19 | public RelationView<?> getView() { |
19 | return view; | 20 | return view; |
20 | } | 21 | } |
22 | |||
21 | public void setView(FilteredRelationView<?> view) { | 23 | public void setView(FilteredRelationView<?> view) { |
22 | this.view = view; | 24 | this.view = view; |
23 | } | 25 | } |
26 | |||
24 | public List<Variable> getSubstitution() { | 27 | public List<Variable> getSubstitution() { |
25 | return substitution; | 28 | return substitution; |
26 | } | 29 | } |
30 | |||
27 | public void setSubstitution(List<Variable> substitution) { | 31 | public void setSubstitution(List<Variable> substitution) { |
28 | this.substitution = substitution; | 32 | this.substitution = substitution; |
29 | } | 33 | } |
30 | 34 | ||
31 | @Override | 35 | @Override |
32 | public void unifyVariables(Map<String, Variable> variables) { | 36 | public void unifyVariables(Map<String, Variable> variables) { |
33 | for(int i = 0; i<this.substitution.size(); i++) { | 37 | for (int i = 0; i < this.substitution.size(); i++) { |
34 | final Object term = this.substitution.get(i); | 38 | final Object term = this.substitution.get(i); |
35 | if(term instanceof Variable) { | 39 | if (term instanceof Variable variableReference) { |
36 | Variable variableReference = (Variable) term; | ||
37 | this.substitution.set(i, DNFAtom.unifyVariables(variables, variableReference)); | 40 | this.substitution.set(i, DNFAtom.unifyVariables(variables, variableReference)); |
38 | } | 41 | } |
39 | } | 42 | } |
40 | } | 43 | } |
44 | |||
41 | @Override | 45 | @Override |
42 | public void collectAllVariables(Set<Variable> variables) { | 46 | public void collectAllVariables(Set<Variable> variables) { |
43 | DNFAtom.addToCollection(variables, substitution); | 47 | DNFAtom.addToCollection(variables, substitution); |