Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import org.gridsuite.modification.dto.*;
import org.gridsuite.modification.utils.ModificationUtils;

import java.util.function.Consumer;

import static org.gridsuite.modification.NetworkModificationException.Type.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS_ERROR;

/**
Expand Down Expand Up @@ -133,9 +135,15 @@ private void setConnectionAttributes(java.util.function.Consumer<AttributeModifi
java.util.function.Consumer<AttributeModification<String>> setName,
java.util.function.Consumer<AttributeModification<ConnectablePosition.Direction>> setDirection,
MoveFeederBayInfos info) {
setPosition.accept(new AttributeModification<>(info.getConnectionPosition(), OperationType.SET));
setName.accept(new AttributeModification<>(info.getConnectionName(), OperationType.SET));
setDirection.accept(new AttributeModification<>(info.getConnectionDirection(), OperationType.SET));
acceptIfNotNull(setPosition, info.getConnectionPosition());
acceptIfNotNull(setName, info.getConnectionName());
acceptIfNotNull(setDirection, info.getConnectionDirection());
}

private <T> void acceptIfNotNull(Consumer<AttributeModification<T>> setter, T value) {
if (value != null) {
setter.accept(new AttributeModification<>(value, OperationType.SET));
}
}

private void moveFeederBay(Network network, Connectable<?> connectable, MoveFeederBayInfos info, ReportNode subReportNode) {
Expand Down