aboutsummaryrefslogtreecommitdiffstats
path: root/store/src/main/java/org/eclipse/viatra/solver/data/query/building/EquivalenceAtom.java
blob: b47fe2a82bdcb28dd1985a86bb42b50aae338cef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package org.eclipse.viatra.solver.data.query.building;

import java.util.Map;
import java.util.Set;

public class EquivalenceAtom implements DNFAtom{
	private boolean positive;
	private Variable left;
	private Variable right;
	public EquivalenceAtom(boolean positive, Variable left, Variable right) {
		this.positive = positive;
		this.left = left;
		this.right = right;
	}
	public boolean isPositive() {
		return positive;
	}
	public void setPositive(boolean positive) {
		this.positive = positive;
	}
	public Variable getLeft() {
		return left;
	}
	public void setLeft(Variable left) {
		this.left = left;
	}
	public Variable getRight() {
		return right;
	}
	public void setRight(Variable right) {
		this.right = right;
	}
	
	@Override
	public void unifyVariables(Map<String, Variable> variables) {
		this.left = DNFAtom.unifyVariables(variables,left);
		this.right = DNFAtom.unifyVariables(variables,right);
	}
	@Override
	public void collectAllVariables(Set<Variable> variables) {
		DNFAtom.addToCollection(variables, left);
		DNFAtom.addToCollection(variables, right);
	}
}