diff options
author | 2021-09-29 02:45:57 +0200 | |
---|---|---|
committer | 2021-09-29 03:16:01 +0200 | |
commit | a155f6ba02e08a75ce6e474a86900b8363f506e8 (patch) | |
tree | b78804c1c0f0968a9625f0656e08f5dadc16924c /store/src/main/java/org/eclipse/viatra/solver/data/query/building/RelationAtom.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/RelationAtom.java')
-rw-r--r-- | store/src/main/java/org/eclipse/viatra/solver/data/query/building/RelationAtom.java | 45 |
1 files changed, 45 insertions, 0 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 new file mode 100644 index 00000000..f7152bba --- /dev/null +++ b/store/src/main/java/org/eclipse/viatra/solver/data/query/building/RelationAtom.java | |||
@@ -0,0 +1,45 @@ | |||
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 | import org.eclipse.viatra.solver.data.query.view.FilteredRelationView; | ||
8 | import org.eclipse.viatra.solver.data.query.view.RelationView; | ||
9 | |||
10 | public class RelationAtom implements DNFAtom{ | ||
11 | RelationView<?> view; | ||
12 | List<Variable> substitution; | ||
13 | |||
14 | public RelationAtom(RelationView<?> view, List<Variable> substitution) { | ||
15 | this.view = view; | ||
16 | this.substitution = substitution; | ||
17 | } | ||
18 | public RelationView<?> getView() { | ||
19 | return view; | ||
20 | } | ||
21 | public void setView(FilteredRelationView<?> view) { | ||
22 | this.view = view; | ||
23 | } | ||
24 | public List<Variable> getSubstitution() { | ||
25 | return substitution; | ||
26 | } | ||
27 | public void setSubstitution(List<Variable> substitution) { | ||
28 | this.substitution = substitution; | ||
29 | } | ||
30 | |||
31 | @Override | ||
32 | public void unifyVariables(Map<String, Variable> variables) { | ||
33 | for(int i = 0; i<this.substitution.size(); i++) { | ||
34 | final Object term = this.substitution.get(i); | ||
35 | if(term instanceof Variable) { | ||
36 | Variable variableReference = (Variable) term; | ||
37 | this.substitution.set(i, DNFAtom.unifyVariables(variables, variableReference)); | ||
38 | } | ||
39 | } | ||
40 | } | ||
41 | @Override | ||
42 | public void collectAllVariables(Set<Variable> variables) { | ||
43 | DNFAtom.addToCollection(variables, substitution); | ||
44 | } | ||
45 | } | ||