diff options
author | Kristóf Marussy <marussy@mit.bme.hu> | 2021-09-29 02:45:57 +0200 |
---|---|---|
committer | Kristóf Marussy <marussy@mit.bme.hu> | 2021-09-29 03:16:01 +0200 |
commit | a155f6ba02e08a75ce6e474a86900b8363f506e8 (patch) | |
tree | b78804c1c0f0968a9625f0656e08f5dadc16924c /store/src/main/java/org/eclipse/viatra/solver/data/query/building/PredicateAtom.java | |
parent | Simplify branding (diff) | |
download | refinery-a155f6ba02e08a75ce6e474a86900b8363f506e8.tar.gz refinery-a155f6ba02e08a75ce6e474a86900b8363f506e8.tar.zst refinery-a155f6ba02e08a75ce6e474a86900b8363f506e8.zip |
build: migration to Gradle 7
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 | 57 |
1 files changed, 57 insertions, 0 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 new file mode 100644 index 00000000..3e5ef88e --- /dev/null +++ b/store/src/main/java/org/eclipse/viatra/solver/data/query/building/PredicateAtom.java | |||
@@ -0,0 +1,57 @@ | |||
1 | package org.eclipse.viatra.solver.data.query.building; | ||
2 | |||
3 | import java.util.List; | ||
4 | import java.util.Map; | ||
5 | import java.util.Set; | ||
6 | |||
7 | public class PredicateAtom implements DNFAtom{ | ||
8 | private DNFPredicate referred; | ||
9 | private List<Variable> substitution; | ||
10 | private boolean positive; | ||
11 | private boolean transitive; | ||
12 | |||
13 | public PredicateAtom(boolean positive, boolean transitive, DNFPredicate referred, List<Variable> substitution) { | ||
14 | this.positive = positive; | ||
15 | this.referred = referred; | ||
16 | this.substitution = substitution; | ||
17 | this.transitive = transitive; | ||
18 | } | ||
19 | public DNFPredicate getReferred() { | ||
20 | return referred; | ||
21 | } | ||
22 | public void setReferred(DNFPredicate referred) { | ||
23 | this.referred = referred; | ||
24 | } | ||
25 | public List<Variable> getSubstitution() { | ||
26 | return substitution; | ||
27 | } | ||
28 | public void setSubstitution(List<Variable> substitution) { | ||
29 | this.substitution = substitution; | ||
30 | } | ||
31 | public boolean isPositive() { | ||
32 | return positive; | ||
33 | } | ||
34 | public void setPositive(boolean positive) { | ||
35 | this.positive = positive; | ||
36 | } | ||
37 | public boolean isTransitive() { | ||
38 | return transitive; | ||
39 | } | ||
40 | public void setTransitive(boolean transitive) { | ||
41 | this.transitive = transitive; | ||
42 | } | ||
43 | @Override | ||
44 | public void unifyVariables(Map<String, Variable> variables) { | ||
45 | for(int i = 0; i<this.substitution.size(); i++) { | ||
46 | final Object term = this.substitution.get(i); | ||
47 | if(term instanceof Variable) { | ||
48 | Variable variableReference = (Variable) term; | ||
49 | this.substitution.set(i, DNFAtom.unifyVariables(variables, variableReference)); | ||
50 | } | ||
51 | } | ||
52 | } | ||
53 | @Override | ||
54 | public void collectAllVariables(Set<Variable> variables) { | ||
55 | DNFAtom.addToCollection(variables, substitution); | ||
56 | } | ||
57 | } | ||