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/PredicateAtom.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/PredicateAtom.java')
-rw-r--r-- | store/src/main/java/org/eclipse/viatra/solver/data/query/building/PredicateAtom.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/store/src/main/java/org/eclipse/viatra/solver/data/query/building/PredicateAtom.java b/store/src/main/java/org/eclipse/viatra/solver/data/query/building/PredicateAtom.java index 3e5ef88e..439298d0 100644 --- a/store/src/main/java/org/eclipse/viatra/solver/data/query/building/PredicateAtom.java +++ b/store/src/main/java/org/eclipse/viatra/solver/data/query/building/PredicateAtom.java | |||
@@ -4,52 +4,61 @@ import java.util.List; | |||
4 | import java.util.Map; | 4 | import java.util.Map; |
5 | import java.util.Set; | 5 | import java.util.Set; |
6 | 6 | ||
7 | public class PredicateAtom implements DNFAtom{ | 7 | public class PredicateAtom implements DNFAtom { |
8 | private DNFPredicate referred; | 8 | private DNFPredicate referred; |
9 | private List<Variable> substitution; | 9 | private List<Variable> substitution; |
10 | private boolean positive; | 10 | private boolean positive; |
11 | private boolean transitive; | 11 | private boolean transitive; |
12 | 12 | ||
13 | public PredicateAtom(boolean positive, boolean transitive, DNFPredicate referred, List<Variable> substitution) { | 13 | public PredicateAtom(boolean positive, boolean transitive, DNFPredicate referred, List<Variable> substitution) { |
14 | this.positive = positive; | 14 | this.positive = positive; |
15 | this.referred = referred; | 15 | this.referred = referred; |
16 | this.substitution = substitution; | 16 | this.substitution = substitution; |
17 | this.transitive = transitive; | 17 | this.transitive = transitive; |
18 | } | 18 | } |
19 | |||
19 | public DNFPredicate getReferred() { | 20 | public DNFPredicate getReferred() { |
20 | return referred; | 21 | return referred; |
21 | } | 22 | } |
23 | |||
22 | public void setReferred(DNFPredicate referred) { | 24 | public void setReferred(DNFPredicate referred) { |
23 | this.referred = referred; | 25 | this.referred = referred; |
24 | } | 26 | } |
27 | |||
25 | public List<Variable> getSubstitution() { | 28 | public List<Variable> getSubstitution() { |
26 | return substitution; | 29 | return substitution; |
27 | } | 30 | } |
31 | |||
28 | public void setSubstitution(List<Variable> substitution) { | 32 | public void setSubstitution(List<Variable> substitution) { |
29 | this.substitution = substitution; | 33 | this.substitution = substitution; |
30 | } | 34 | } |
35 | |||
31 | public boolean isPositive() { | 36 | public boolean isPositive() { |
32 | return positive; | 37 | return positive; |
33 | } | 38 | } |
39 | |||
34 | public void setPositive(boolean positive) { | 40 | public void setPositive(boolean positive) { |
35 | this.positive = positive; | 41 | this.positive = positive; |
36 | } | 42 | } |
43 | |||
37 | public boolean isTransitive() { | 44 | public boolean isTransitive() { |
38 | return transitive; | 45 | return transitive; |
39 | } | 46 | } |
47 | |||
40 | public void setTransitive(boolean transitive) { | 48 | public void setTransitive(boolean transitive) { |
41 | this.transitive = transitive; | 49 | this.transitive = transitive; |
42 | } | 50 | } |
51 | |||
43 | @Override | 52 | @Override |
44 | public void unifyVariables(Map<String, Variable> variables) { | 53 | public void unifyVariables(Map<String, Variable> variables) { |
45 | for(int i = 0; i<this.substitution.size(); i++) { | 54 | for (int i = 0; i < this.substitution.size(); i++) { |
46 | final Object term = this.substitution.get(i); | 55 | final Object term = this.substitution.get(i); |
47 | if(term instanceof Variable) { | 56 | if (term instanceof Variable variableReference) { |
48 | Variable variableReference = (Variable) term; | ||
49 | this.substitution.set(i, DNFAtom.unifyVariables(variables, variableReference)); | 57 | this.substitution.set(i, DNFAtom.unifyVariables(variables, variableReference)); |
50 | } | 58 | } |
51 | } | 59 | } |
52 | } | 60 | } |
61 | |||
53 | @Override | 62 | @Override |
54 | public void collectAllVariables(Set<Variable> variables) { | 63 | public void collectAllVariables(Set<Variable> variables) { |
55 | DNFAtom.addToCollection(variables, substitution); | 64 | DNFAtom.addToCollection(variables, substitution); |