Skip to content

Commit 8313a12

Browse files
committed
Fixes
Signed-off-by: Florian Dupuy <[email protected]>
1 parent e0b2dd1 commit 8313a12

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

network-area-diagram/src/main/java/com/powsybl/nad/build/iidm/CountryGraphBuilder.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import com.powsybl.nad.svg.EdgeInfo;
1818

1919
import java.util.*;
20-
import java.util.stream.Collectors;
2120

2221
/**
2322
* Graph builder that creates a graph based on substation countries.
@@ -50,12 +49,11 @@ public Graph buildGraph() {
5049
Graph graph = new Graph();
5150

5251
// Get all countries from substations
53-
Set<Country> countries = getCountries();
5452

5553
// Create a VoltageLevelNode with one BusNode for each country
5654
Map<Country, VoltageLevelNode> countryToVlNode = new EnumMap<>(Country.class);
5755

58-
for (Country country : countries) {
56+
for (Country country : getCountries()) {
5957
CountryLabelProvider.CountryLegend legend = labelProvider.getCountryLegend(country);
6058
VoltageLevelNode vlNode = new VoltageLevelNode(
6159
idProvider,
@@ -85,13 +83,14 @@ public Graph buildGraph() {
8583
/**
8684
* Gets all countries from substations in the network.
8785
*
88-
* @return set of countries
86+
* @return list of countries
8987
*/
90-
private Set<Country> getCountries() {
88+
private List<Country> getCountries() {
9189
return network.getSubstationStream()
9290
.map(Substation::getNullableCountry)
9391
.filter(Objects::nonNull)
94-
.collect(Collectors.toSet());
92+
.distinct()
93+
.toList();
9594
}
9695

9796
/**
@@ -104,7 +103,7 @@ private void createCountryConnections(Graph graph,
104103
Map<Country, VoltageLevelNode> countryToVlNode) {
105104

106105
// Map to store aggregated active powers between countries
107-
Map<Border, BorderEdges> borderEdgesMap = new HashMap<>();
106+
Map<Border, BorderEdges> borderEdgesMap = new LinkedHashMap<>();
108107

109108
// Process all lines
110109
network.getLineStream().forEach(line -> fillBorderEdgesMap(line, borderEdgesMap));

0 commit comments

Comments
 (0)