Skip to content

Commit

Permalink
Make it simple
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas ADAM <[email protected]>
  • Loading branch information
tadam50 committed Feb 6, 2024
1 parent 77143ef commit 84ca850
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import java.io.IOException;
import java.io.StringWriter;
import java.util.List;
import java.util.function.Predicate;

/**
Expand Down Expand Up @@ -76,18 +75,10 @@ protected String call() {
}

private static Predicate<VoltageLevel> getVoltageLevelFilter(Network network, NetworkAreaDiagramModel model, Container<?> container) {
switch (container.getContainerType()) {
case NETWORK -> {
return VoltageLevelFilter.NO_FILTER;
}
case SUBSTATION -> {
List<String> vls = ((Substation) container).getVoltageLevelStream().map(VoltageLevel::getId).toList();
return VoltageLevelFilter.createVoltageLevelsDepthFilter(network, vls, model.getDepth());
}
case VOLTAGE_LEVEL -> {
return VoltageLevelFilter.createVoltageLevelDepthFilter(network, container.getId(), model.getDepth());
}
default -> throw new AssertionError();
}
return switch (container.getContainerType()) {
case NETWORK -> VoltageLevelFilter.NO_FILTER;
case SUBSTATION -> VoltageLevelFilter.createVoltageLevelsDepthFilter(network, ((Substation) container).getVoltageLevelStream().map(VoltageLevel::getId).toList(), model.getDepth());
case VOLTAGE_LEVEL -> VoltageLevelFilter.createVoltageLevelDepthFilter(network, container.getId(), model.getDepth());
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public BooleanProperty substituteSingularFictitiousNodesProperty() {

public PositionVoltageLevelLayoutFactoryParameters getParameters() {
PositionVoltageLevelLayoutFactoryParameters parameters = new PositionVoltageLevelLayoutFactoryParameters();
parameters.setFeederStacked(stackFeeders.get());
parameters.setExceptionIfPatternNotHandled(exceptionWhenPatternUnhandled.get());
parameters.setHandleShunts(handleShunts.get());
parameters.setRemoveUnnecessaryFictitiousNodes(removeFictitiousNodes.get());
parameters.setSubstituteSingularFictitiousByFeederNode(substituteSingularFictitiousNodes.get());
parameters.setFeederStacked(stackFeeders.get())
.setExceptionIfPatternNotHandled(exceptionWhenPatternUnhandled.get())
.setHandleShunts(handleShunts.get())
.setRemoveUnnecessaryFictitiousNodes(removeFictitiousNodes.get())
.setSubstituteSingularFictitiousByFeederNode(substituteSingularFictitiousNodes.get());
return parameters;
}

Expand Down

0 comments on commit 84ca850

Please sign in to comment.