-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathParenthesisConstraint.java
More file actions
66 lines (54 loc) · 1.69 KB
/
Copy pathParenthesisConstraint.java
File metadata and controls
66 lines (54 loc) · 1.69 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package de.vill.model.constraint;
import de.vill.model.building.VariableReference;
import de.vill.util.ConstantSymbols;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
public class ParenthesisConstraint extends Constraint {
private Constraint content;
public ParenthesisConstraint(Constraint content) {
this.content = content;
}
public Constraint getContent() {
return content;
}
@Override
public String toString(boolean withSubmodels, String currentAlias) {
return ConstantSymbols.PAREN_OPEN +
content.toString(withSubmodels, currentAlias) +
ConstantSymbols.PAREN_CLOSE;
}
@Override
public List<Constraint> getConstraintSubParts() {
return Arrays.asList(content);
}
@Override
public void replaceConstraintSubPart(Constraint oldSubConstraint, Constraint newSubConstraint) {
if (content == oldSubConstraint) {
content = newSubConstraint;
}
}
@Override
public Constraint clone() {
return new ParenthesisConstraint(content.clone());
}
@Override
public int hashCode(int level) {
return 31 * level + (content == null ? 0 : content.hashCode(1 + level));
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
ParenthesisConstraint other = (ParenthesisConstraint) obj;
return Objects.equals(content, other.content);
}
@Override
public List<VariableReference> getReferences() {
return content.getReferences();
}
}