Skip to content

Commit

Permalink
PR remark
Browse files Browse the repository at this point in the history
Signed-off-by: TOURI ANIS <[email protected]>
  • Loading branch information
anistouri committed Sep 11, 2024
1 parent 44bd70a commit 14be4cc
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.apache.commons.collections4.CollectionUtils;

import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.*;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -170,14 +169,10 @@ private void updateCalculatedBusAttributesIfNeeded(double newValue, String volta
.getCalculatedBusesForBusView();

if (CollectionUtils.isNotEmpty(calculatedBusAttributesList)) {
List<Integer> calculatedBusesNum = getAllTerminals().stream().map(t -> {
if (t.getBusView() != null && t.getBusView().getBus() instanceof CalculatedBus) {
CalculatedBus bus = (CalculatedBus) t.getBusView().getBus();
return bus != null ? bus.getCalculatedBusNum() : null;
}
return null;
})
.filter(Objects::nonNull).distinct().toList();
List<Integer> calculatedBusesNum = getAllTerminals().stream()
.filter(t -> t.isConnected())
.map(t -> ((CalculatedBus) t.getBusView().getBus()).getCalculatedBusNum())
.toList();
List<CalculatedBusAttributes> busesToUpdateList = IntStream.range(0, calculatedBusAttributesList.size())
.filter(calculatedBusesNum::contains)
.mapToObj(calculatedBusAttributesList::get)
Expand Down

0 comments on commit 14be4cc

Please sign in to comment.