Skip to content

Commit c4506eb

Browse files
author
Julia Pham
committed
style: fix indentation
1 parent ccd4b14 commit c4506eb

File tree

2 files changed

+31
-38
lines changed

2 files changed

+31
-38
lines changed

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

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,18 @@ public AndConstraint(Constraint left, Constraint right) {
2929
}
3030

3131
public Constraint getLeft() {
32-
if (children.isEmpty()){
32+
if (children.isEmpty()) {
3333
throw new ParseError("Left child can not be returned because there are no children.");
34-
}
35-
else{
34+
} else {
3635
return children.get(0);
3736
}
3837
}
3938

4039
public Constraint getRight() {
41-
if (children.isEmpty() || children.size() < 2){
42-
throw new ParseError("Right child can not be returned because there are less than two children.");;
43-
}
44-
else{
40+
if (children.isEmpty() || children.size() < 2) {
41+
throw new ParseError("Right child can not be returned because there are less than two children.");
42+
;
43+
} else {
4544
return children.get(children.size() - 1);
4645
}
4746
}
@@ -53,29 +52,27 @@ public List<Constraint> getChildren() {
5352
public void setLeft(Constraint left) {
5453
if (children.isEmpty()) {
5554
children.add(left);
56-
}
57-
else {
55+
} else {
5856
children.set(0, left);
5957
}
6058
}
6159

62-
public void setRight(Constraint right){
60+
public void setRight(Constraint right) {
6361
if (children.size() < 2) {
6462
if (children.size() < 1) {
6563
children.add(null);
6664
}
6765
children.add(right);
68-
}
69-
else {
66+
} else {
7067
children.set(children.size() - 1, right);
7168
}
7269
}
7370

7471
@Override
7572
public String toString(boolean withSubmodels, String currentAlias) {
76-
return children.stream()
77-
.map(c -> AutomaticBrackets.enforceConstraintBracketsIfNecessary(this, c, withSubmodels, currentAlias))
78-
.collect(Collectors.joining(" & "));
73+
return children.stream()
74+
.map(c -> AutomaticBrackets.enforceConstraintBracketsIfNecessary(this, c, withSubmodels, currentAlias))
75+
.collect(Collectors.joining(" & "));
7976
}
8077

8178
@Override
@@ -85,8 +82,8 @@ public List<Constraint> getConstraintSubParts() {
8582

8683
@Override
8784
public void replaceConstraintSubPart(Constraint oldSubConstraint, Constraint newSubConstraint) {
88-
for (int i = 0; i< children.size(); i++) {
89-
if (children.get(i) == oldSubConstraint){
85+
for (int i = 0; i < children.size(); i++) {
86+
if (children.get(i) == oldSubConstraint) {
9087
children.set(i, newSubConstraint);
9188
}
9289
}
@@ -101,7 +98,7 @@ public Constraint clone() {
10198
return clone;
10299
}
103100

104-
public void addChild(Constraint constraint){
101+
public void addChild(Constraint constraint) {
105102
if (constraint != null) {
106103
children.add(constraint);
107104
}
@@ -111,7 +108,7 @@ public void addChild(Constraint constraint){
111108
public int hashCode(int level) {
112109
final int prime = 31;
113110
int result = prime * level;
114-
for(Constraint c: children) {
111+
for (Constraint c : children) {
115112
result = prime * result + (c == null ? 0 : c.hashCode(1 + level));
116113
}
117114
return result;
@@ -132,7 +129,7 @@ public boolean equals(Object obj) {
132129
@Override
133130
public List<VariableReference> getReferences() {
134131
List<VariableReference> references = new ArrayList<>();
135-
for(Constraint c: children){
132+
for (Constraint c : children) {
136133
references.addAll(c.getReferences());
137134
}
138135
return references;

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

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,17 @@ public OrConstraint(Constraint left, Constraint right) {
2828
}
2929

3030
public Constraint getLeft() {
31-
if (children.isEmpty()){
31+
if (children.isEmpty()) {
3232
throw new ParseError("Left child can not be returned because there are no children.");
33-
}
34-
else{
33+
} else {
3534
return children.get(0);
3635
}
3736
}
3837

3938
public Constraint getRight() {
40-
if (children.isEmpty() || children.size() < 2){
39+
if (children.isEmpty() || children.size() < 2) {
4140
throw new ParseError("RIght child can not be returned because there are less than two children.");
42-
}
43-
else{
41+
} else {
4442
return children.get(children.size() - 1);
4543
}
4644
}
@@ -52,29 +50,27 @@ public List<Constraint> getChildren() {
5250
public void setLeft(Constraint left) {
5351
if (children.isEmpty()) {
5452
children.add(left);
55-
}
56-
else {
53+
} else {
5754
children.set(0, left);
5855
}
5956
}
6057

61-
public void setRight(Constraint right){
58+
public void setRight(Constraint right) {
6259
if (children.size() < 2) {
6360
if (children.size() < 1) {
6461
children.add(null);
6562
}
6663
children.add(right);
67-
}
68-
else {
64+
} else {
6965
children.set(children.size() - 1, right);
7066
}
7167
}
7268

7369
@Override
7470
public String toString(boolean withSubmodels, String currentAlias) {
7571
return children.stream()
76-
.map(c -> AutomaticBrackets.enforceConstraintBracketsIfNecessary(this, c, withSubmodels, currentAlias))
77-
.collect(Collectors.joining(" | "));
72+
.map(c -> AutomaticBrackets.enforceConstraintBracketsIfNecessary(this, c, withSubmodels, currentAlias))
73+
.collect(Collectors.joining(" | "));
7874
}
7975

8076
@Override
@@ -84,8 +80,8 @@ public List<Constraint> getConstraintSubParts() {
8480

8581
@Override
8682
public void replaceConstraintSubPart(Constraint oldSubConstraint, Constraint newSubConstraint) {
87-
for (int i = 0; i< children.size(); i++) {
88-
if (children.get(i) == oldSubConstraint){
83+
for (int i = 0; i < children.size(); i++) {
84+
if (children.get(i) == oldSubConstraint) {
8985
children.set(i, newSubConstraint);
9086
}
9187
}
@@ -100,7 +96,7 @@ public Constraint clone() {
10096
return clone;
10197
}
10298

103-
public void addChild(Constraint constraint){
99+
public void addChild(Constraint constraint) {
104100
if (constraint != null) {
105101
children.add(constraint);
106102
}
@@ -110,7 +106,7 @@ public void addChild(Constraint constraint){
110106
public int hashCode(int level) {
111107
final int prime = 31;
112108
int result = prime * level;
113-
for(Constraint c: children) {
109+
for (Constraint c : children) {
114110
result = prime * result + (c == null ? 0 : c.hashCode(1 + level));
115111
}
116112
return result;
@@ -131,7 +127,7 @@ public boolean equals(Object obj) {
131127
@Override
132128
public List<VariableReference> getReferences() {
133129
List<VariableReference> references = new ArrayList<>();
134-
for(Constraint c: children){
130+
for (Constraint c : children) {
135131
references.addAll(c.getReferences());
136132
}
137133
return references;

0 commit comments

Comments
 (0)