-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow PositionVoltageLevelLayoutFactory parametrization (#562)
* Add new parameter class for PositionVoltageLevelLayoutFactory parametrization * Use another PositionVoltageLevelLayoutFactory constructor --------- Signed-off-by: Sophie Frasnedo <[email protected]>
- Loading branch information
Showing
11 changed files
with
175 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...ore/src/main/java/com/powsybl/sld/layout/PositionVoltageLevelLayoutFactoryParameters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** | ||
* Copyright (c) 2023, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
package com.powsybl.sld.layout; | ||
|
||
import com.powsybl.sld.model.coordinate.Side; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* | ||
* @author Sophie Frasnedo <sophie.frasnedo at rte-france.com> | ||
*/ | ||
|
||
public class PositionVoltageLevelLayoutFactoryParameters { | ||
private boolean feederStacked = true; | ||
private boolean removeUnnecessaryFictitiousNodes = true; | ||
private boolean substituteSingularFictitiousByFeederNode = true; | ||
private boolean exceptionIfPatternNotHandled = false; | ||
private boolean handleShunts = false; | ||
private Map<String, Side> busInfoMap = new HashMap<>(); | ||
|
||
public boolean isFeederStacked() { | ||
return feederStacked; | ||
} | ||
|
||
public PositionVoltageLevelLayoutFactoryParameters setFeederStacked(boolean feederStacked) { | ||
this.feederStacked = feederStacked; | ||
return this; | ||
} | ||
|
||
public boolean isExceptionIfPatternNotHandled() { | ||
return exceptionIfPatternNotHandled; | ||
} | ||
|
||
public PositionVoltageLevelLayoutFactoryParameters setExceptionIfPatternNotHandled(boolean exceptionIfPatternNotHandled) { | ||
this.exceptionIfPatternNotHandled = exceptionIfPatternNotHandled; | ||
return this; | ||
} | ||
|
||
public boolean isRemoveUnnecessaryFictitiousNodes() { | ||
return removeUnnecessaryFictitiousNodes; | ||
} | ||
|
||
public PositionVoltageLevelLayoutFactoryParameters setRemoveUnnecessaryFictitiousNodes(boolean removeUnnecessaryFictitiousNodes) { | ||
this.removeUnnecessaryFictitiousNodes = removeUnnecessaryFictitiousNodes; | ||
return this; | ||
} | ||
|
||
public boolean isSubstituteSingularFictitiousByFeederNode() { | ||
return substituteSingularFictitiousByFeederNode; | ||
} | ||
|
||
public PositionVoltageLevelLayoutFactoryParameters setSubstituteSingularFictitiousByFeederNode(boolean substituteSingularFictitiousByFeederNode) { | ||
this.substituteSingularFictitiousByFeederNode = substituteSingularFictitiousByFeederNode; | ||
return this; | ||
} | ||
|
||
public boolean isHandleShunts() { | ||
return handleShunts; | ||
} | ||
|
||
public PositionVoltageLevelLayoutFactoryParameters setHandleShunts(boolean handleShunts) { | ||
this.handleShunts = handleShunts; | ||
return this; | ||
} | ||
|
||
public Map<String, Side> getBusInfoMap() { | ||
return busInfoMap; | ||
} | ||
|
||
public PositionVoltageLevelLayoutFactoryParameters setBusInfoMap(Map<String, Side> busInfoMap) { | ||
this.busInfoMap = busInfoMap; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...src/test/java/com/powsybl/sld/layout/PositionVoltageLevelLayoutFactoryParametersTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* Copyright (c) 2019, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package com.powsybl.sld.layout; | ||
|
||
import com.powsybl.sld.model.coordinate.Side; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
/** | ||
* @author Thomas Adam <tadam at silicom.fr> | ||
*/ | ||
class PositionVoltageLevelLayoutFactoryParametersTest { | ||
|
||
@Test | ||
void test() { | ||
PositionVoltageLevelLayoutFactoryParameters parameters = new PositionVoltageLevelLayoutFactoryParameters(); | ||
|
||
assertTrue(parameters.isFeederStacked()); | ||
parameters.setFeederStacked(false); | ||
assertFalse(parameters.isFeederStacked()); | ||
|
||
assertTrue(parameters.isRemoveUnnecessaryFictitiousNodes()); | ||
parameters.setRemoveUnnecessaryFictitiousNodes(false); | ||
assertFalse(parameters.isRemoveUnnecessaryFictitiousNodes()); | ||
|
||
assertTrue(parameters.isSubstituteSingularFictitiousByFeederNode()); | ||
parameters.setSubstituteSingularFictitiousByFeederNode(false); | ||
assertFalse(parameters.isSubstituteSingularFictitiousByFeederNode()); | ||
|
||
assertFalse(parameters.isExceptionIfPatternNotHandled()); | ||
parameters.setExceptionIfPatternNotHandled(true); | ||
assertTrue(parameters.isExceptionIfPatternNotHandled()); | ||
|
||
assertFalse(parameters.isHandleShunts()); | ||
parameters.setHandleShunts(true); | ||
assertTrue(parameters.isHandleShunts()); | ||
|
||
assertTrue(parameters.getBusInfoMap().isEmpty()); | ||
Map<String, Side> busInfoMap = new HashMap<>(); | ||
busInfoMap.put("???", Side.LEFT); | ||
parameters.setBusInfoMap(busInfoMap); | ||
assertFalse(parameters.getBusInfoMap().isEmpty()); | ||
} | ||
} |
49 changes: 0 additions & 49 deletions
49
...gram-core/src/test/java/com/powsybl/sld/layout/PositionVoltageLevelLayoutFactoryTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.