Skip to content

Commit

Permalink
Fix code smells
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
  • Loading branch information
flo-dup committed Mar 25, 2024
1 parent e158ac6 commit 356a1c8
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2236,9 +2236,9 @@ public static Network createNetworkWithComplexInternCellDifferentSubsections1()
Networks.createLoad(voltageLevel, "load", "load", "load", null, ConnectablePosition.Direction.TOP, 3, 10d, 10d);
Networks.createSwitch(voltageLevel, "dl11", "dl111", SwitchKind.DISCONNECTOR, false, false, false, 0, 3);
Networks.createSwitch(voltageLevel, "dl121", "dl12", SwitchKind.DISCONNECTOR, false, true, false, 1, 3);
Networks.createSwitch(voltageLevel, "d11", "d11", SwitchKind.DISCONNECTOR, false, false, false, 0, 4);
Networks.createSwitch(voltageLevel, "d12", "d12", SwitchKind.DISCONNECTOR, false, false, false, 1, 4);
Networks.createSwitch(voltageLevel, "d21", "d21", SwitchKind.DISCONNECTOR, false, false, false, 2, 4);
Networks.createSwitch(voltageLevel, "d11", "d11", SwitchKind.DISCONNECTOR, false, false, false, 0, 11);
Networks.createSwitch(voltageLevel, "d12", "d12", SwitchKind.DISCONNECTOR, false, true, false, 1, 11);
Networks.createSwitch(voltageLevel, "d21", "d21", SwitchKind.DISCONNECTOR, false, false, false, 2, 11);

return network;
}
Expand All @@ -2252,14 +2252,14 @@ public static Network createNetworkWithComplexInternCellDifferentSubsections() {
Networks.createBusBarSection(voltageLevel, "1.2", "1.2", 1, 2, 1);
Networks.createBusBarSection(voltageLevel, "2.1", "2.1", 2, 1, 2);

Networks.createLoad(voltageLevel, "load0", "load0", "load0", null, ConnectablePosition.Direction.TOP, 3, 10d, 10d);
Networks.createSwitch(voltageLevel, "dl0", "dl0", SwitchKind.DISCONNECTOR, false, false, false, 0, 3);
Networks.createLoad(voltageLevel, "load2", "load2", "load2", null, ConnectablePosition.Direction.TOP, 4, 10d, 10d);
Networks.createLoad(voltageLevel, LOAD_1_ID, LOAD_1_ID, LOAD_1_ID, null, ConnectablePosition.Direction.TOP, 3, 10d, 10d);
Networks.createSwitch(voltageLevel, "dl1", "dl1", SwitchKind.DISCONNECTOR, false, false, false, 0, 3);
Networks.createLoad(voltageLevel, LOAD_2_ID, LOAD_2_ID, LOAD_2_ID, null, ConnectablePosition.Direction.TOP, 4, 10d, 10d);
Networks.createSwitch(voltageLevel, "dl2", "dl2", SwitchKind.DISCONNECTOR, false, false, false, 2, 4);

Networks.createSwitch(voltageLevel, "d0", "d0", SwitchKind.DISCONNECTOR, false, true, false, 0, 11);
Networks.createSwitch(voltageLevel, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 1, 11);
Networks.createSwitch(voltageLevel, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 2, 11);
Networks.createSwitch(voltageLevel, "d11", "d11", SwitchKind.DISCONNECTOR, false, true, false, 0, 11);
Networks.createSwitch(voltageLevel, "d12", "d12", SwitchKind.DISCONNECTOR, false, false, false, 1, 11);
Networks.createSwitch(voltageLevel, "d21", "d21", SwitchKind.DISCONNECTOR, false, false, false, 2, 11);

return network;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@
public class ImplicitCellDetector implements CellDetector {

private static final Logger LOGGER = LoggerFactory.getLogger(ImplicitCellDetector.class);
private final boolean exceptionIfPatternNotHandled;

public ImplicitCellDetector(boolean exceptionIfPatternNotHandled) {
this.exceptionIfPatternNotHandled = exceptionIfPatternNotHandled;
}

public ImplicitCellDetector() {
this(false);
}

/**
* internCell detection : an internal cell is composed of nodes connecting BUSes without connecting Feeder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public Layout create(VoltageLevelGraph graph) {
positionVoltageLevelLayoutFactoryParameters.isSubstituteInternalMiddle2wtByEquipmentNodes());

// For cell detection
ImplicitCellDetector cellDetector = new ImplicitCellDetector(positionVoltageLevelLayoutFactoryParameters.isExceptionIfPatternNotHandled());
ImplicitCellDetector cellDetector = new ImplicitCellDetector();

// For building blocks from cells
BlockOrganizer blockOrganizer = new BlockOrganizer(positionFinder, positionVoltageLevelLayoutFactoryParameters.isFeederStacked(), positionVoltageLevelLayoutFactoryParameters.isExceptionIfPatternNotHandled(), positionVoltageLevelLayoutFactoryParameters.isHandleShunts(), positionVoltageLevelLayoutFactoryParameters.getBusInfoMap());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void setUp() {
@Test
void test() {
VoltageLevelGraph g = rawGraphBuilder.buildVoltageLevelGraph("vl");
new ImplicitCellDetector(false).detectCells(g);
new ImplicitCellDetector().detectCells(g);
assertEquals(1, g.getCellStream().count());
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 356a1c8

Please sign in to comment.