Skip to content

Commit a7daa3a

Browse files
author
Julia Pham
committed
feat: added getLeft and getRight for backwards compatibility
1 parent 7c2ec8b commit a7daa3a

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/main/java/de/vill/model/constraint/AndConstraint.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,26 @@ public AndConstraint(Constraint... constraints) {
2222
}
2323

2424
public AndConstraint(Constraint left, Constraint right) {
25-
this(new Constraint[]{left, right});
25+
this.children.add(left);
26+
this.children.add(right);
27+
}
28+
29+
public Constraint getLeft() {
30+
if (children.isEmpty()){
31+
return null;
32+
}
33+
else{
34+
return children.get(0);
35+
}
36+
}
37+
38+
public Constraint getRight() {
39+
if (children.isEmpty() || children.size() < 2){
40+
return null;
41+
}
42+
else{
43+
return children.get(children.size() - 1);
44+
}
2645
}
2746

2847
public List<Constraint> getChildren() {

0 commit comments

Comments
 (0)