Skip to content

Commit edc0997

Browse files
committed
chore: address comments
1 parent 172cd1c commit edc0997

2 files changed

Lines changed: 16 additions & 13 deletions

File tree

java/food-packaging/src/main/java/org/acme/foodpackaging/domain/JobOperatorUpdatingVariableListener.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,42 @@ public class JobOperatorUpdatingVariableListener implements VariableListener<Pac
1212

1313
@Override
1414
public void beforeVariableChanged(@NonNull ScoreDirector<PackagingSchedule> scoreDirector, @NonNull Job job) {
15-
// Empty method
15+
// No need to do anything.
1616
}
1717

1818
@Override
1919
public void afterVariableChanged(@NonNull ScoreDirector<PackagingSchedule> scoreDirector, @NonNull Job job) {
20-
if (job.getLine() == null && job.getLineOperator() != null) {
20+
var line = job.getLine();
21+
var operator = line != null ? line.getOperator() : null;
22+
var lineOperator = job.getLineOperator();
23+
if (line == null && lineOperator != null) {
2124
scoreDirector.beforeVariableChanged(job, LINE_OPERATOR_FIELD);
2225
job.setLineOperator(null);
2326
scoreDirector.afterVariableChanged(job, LINE_OPERATOR_FIELD);
24-
} else if (!Objects.equals(job.getLineOperator(), job.getLine().getOperator())) {
27+
} else if (!Objects.equals(operator, lineOperator)) {
2528
scoreDirector.beforeVariableChanged(job, LINE_OPERATOR_FIELD);
26-
job.setLineOperator(job.getLine().getOperator());
29+
job.setLineOperator(operator);
2730
scoreDirector.afterVariableChanged(job, LINE_OPERATOR_FIELD);
2831
}
2932
}
3033

3134
@Override
3235
public void beforeEntityAdded(@NonNull ScoreDirector<PackagingSchedule> scoreDirector, @NonNull Job job) {
33-
// Empty method
36+
// No need to do anything.
3437
}
3538

3639
@Override
3740
public void afterEntityAdded(@NonNull ScoreDirector<PackagingSchedule> scoreDirector, @NonNull Job job) {
38-
// Empty method
41+
// No need to do anything.
3942
}
4043

4144
@Override
4245
public void beforeEntityRemoved(@NonNull ScoreDirector<PackagingSchedule> scoreDirector, @NonNull Job job) {
43-
// Empty method
46+
// No need to do anything.
4447
}
4548

4649
@Override
4750
public void afterEntityRemoved(@NonNull ScoreDirector<PackagingSchedule> scoreDirector, @NonNull Job job) {
48-
// Empty method
51+
// No need to do anything.
4952
}
5053
}

java/food-packaging/src/main/java/org/acme/foodpackaging/domain/LineOperatorUpdatingVariableListener.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
public class LineOperatorUpdatingVariableListener implements VariableListener<PackagingSchedule, Line> {
1010
@Override
1111
public void beforeVariableChanged(@NonNull ScoreDirector<PackagingSchedule> scoreDirector, @NonNull Line line) {
12-
// Empty method
12+
// No need to do anything.
1313
}
1414

1515
@Override
@@ -25,21 +25,21 @@ public void afterVariableChanged(@NonNull ScoreDirector<PackagingSchedule> score
2525

2626
@Override
2727
public void beforeEntityAdded(@NonNull ScoreDirector<PackagingSchedule> scoreDirector, @NonNull Line line) {
28-
// Empty method
28+
// No need to do anything.
2929
}
3030

3131
@Override
3232
public void afterEntityAdded(@NonNull ScoreDirector<PackagingSchedule> scoreDirector, @NonNull Line line) {
33-
// Empty method
33+
// No need to do anything.
3434
}
3535

3636
@Override
3737
public void beforeEntityRemoved(@NonNull ScoreDirector<PackagingSchedule> scoreDirector, @NonNull Line line) {
38-
// Empty method
38+
// No need to do anything.
3939
}
4040

4141
@Override
4242
public void afterEntityRemoved(@NonNull ScoreDirector<PackagingSchedule> scoreDirector, @NonNull Line line) {
43-
// Empty method
43+
// No need to do anything.
4444
}
4545
}

0 commit comments

Comments
 (0)