@Test public void checkAliasesCreationAfterIidmMerging() { Network networkFR = loadNetworkFromResourceFile("/frTestGridForMerging.uct"); Network networkBE = loadNetworkFromResourceFile("/beTestGridForMerging.uct"); Network merge = Network.create("merge", "UCT"); merge.merge(networkBE, networkFR); assertNull(merge.getIdentifiable("BBBBBB11 XXXXXX11 ABCDE")); assertNull(merge.getIdentifiable("FFFFFF11 XXXXXX11 ABCDE")); assertNotNull(merge.getIdentifiable("BBBBBB11 XXXXXX11 1")); assertNotNull(merge.getIdentifiable("FFFFFF11 XXXXXX11 1")); assertNotEquals("BBBBBB11 XXXXXX11 1", merge.getIdentifiable("BBBBBB11 XXXXXX11 1").getId()); assertNotEquals("FFFFFF11 XXXXXX11 1", merge.getIdentifiable("FFFFFF11 XXXXXX11 1").getId()); UcteAliasesCreation.createAliases(merge); assertNotNull(merge.getIdentifiable("BBBBBB11 XXXXXX11 ABCDE")); assertNotNull(merge.getIdentifiable("FFFFFF11 XXXXXX11 ABCDE")); assertNotNull(merge.getIdentifiable("BBBBBB11 XXXXXX11 1")); assertNotNull(merge.getIdentifiable("FFFFFF11 XXXXXX11 1")); assertEquals(merge.getIdentifiable("BBBBBB11 XXXXXX11 ABCDE"), merge.getIdentifiable("FFFFFF11 XXXXXX11 ABCDE")); assertEquals(merge.getIdentifiable("BBBBBB11 XXXXXX11 ABCDE"), merge.getIdentifiable("BBBBBB11 XXXXXX11 1")); assertEquals(merge.getIdentifiable("FFFFFF11 XXXXXX11 ABCDE"), merge.getIdentifiable("FFFFFF11 XXXXXX11 1")); }
public static void createAliases(Network network) { Set<String> duplicatedAliases = new HashSet<>(); network.getBranchStream().forEach(branch -> { if (branch instanceof TieLine) { TieLine tieLine = (TieLine) branch; tieLine.addAlias(tieLine.getHalf1().getId()); tieLine.addAlias(tieLine.getHalf2().getId()); addHalfElementNameAliases(tieLine, duplicatedAliases); } addElementNameAlias(branch, duplicatedAliases); }); network.getSwitchStream().forEach(switchEl -> addElementNameAlias(switchEl, duplicatedAliases)); network.getDanglingLineStream().forEach(dl -> addElementNameAlias(dl, duplicatedAliases)); }
UcteAliasesCreation { public static void createAliases(Network network) { Set<String> duplicatedAliases = new HashSet<>(); network.getBranchStream().forEach(branch -> { if (branch instanceof TieLine) { TieLine tieLine = (TieLine) branch; tieLine.addAlias(tieLine.getHalf1().getId()); tieLine.addAlias(tieLine.getHalf2().getId()); addHalfElementNameAliases(tieLine, duplicatedAliases); } addElementNameAlias(branch, duplicatedAliases); }); network.getSwitchStream().forEach(switchEl -> addElementNameAlias(switchEl, duplicatedAliases)); network.getDanglingLineStream().forEach(dl -> addElementNameAlias(dl, duplicatedAliases)); } }
UcteAliasesCreation { public static void createAliases(Network network) { Set<String> duplicatedAliases = new HashSet<>(); network.getBranchStream().forEach(branch -> { if (branch instanceof TieLine) { TieLine tieLine = (TieLine) branch; tieLine.addAlias(tieLine.getHalf1().getId()); tieLine.addAlias(tieLine.getHalf2().getId()); addHalfElementNameAliases(tieLine, duplicatedAliases); } addElementNameAlias(branch, duplicatedAliases); }); network.getSwitchStream().forEach(switchEl -> addElementNameAlias(switchEl, duplicatedAliases)); network.getDanglingLineStream().forEach(dl -> addElementNameAlias(dl, duplicatedAliases)); } private  UcteAliasesCreation(); }
UcteAliasesCreation { public static void createAliases(Network network) { Set<String> duplicatedAliases = new HashSet<>(); network.getBranchStream().forEach(branch -> { if (branch instanceof TieLine) { TieLine tieLine = (TieLine) branch; tieLine.addAlias(tieLine.getHalf1().getId()); tieLine.addAlias(tieLine.getHalf2().getId()); addHalfElementNameAliases(tieLine, duplicatedAliases); } addElementNameAlias(branch, duplicatedAliases); }); network.getSwitchStream().forEach(switchEl -> addElementNameAlias(switchEl, duplicatedAliases)); network.getDanglingLineStream().forEach(dl -> addElementNameAlias(dl, duplicatedAliases)); } private  UcteAliasesCreation(); static void createAliases(Network network); }
UcteAliasesCreation { public static void createAliases(Network network) { Set<String> duplicatedAliases = new HashSet<>(); network.getBranchStream().forEach(branch -> { if (branch instanceof TieLine) { TieLine tieLine = (TieLine) branch; tieLine.addAlias(tieLine.getHalf1().getId()); tieLine.addAlias(tieLine.getHalf2().getId()); addHalfElementNameAliases(tieLine, duplicatedAliases); } addElementNameAlias(branch, duplicatedAliases); }); network.getSwitchStream().forEach(switchEl -> addElementNameAlias(switchEl, duplicatedAliases)); network.getDanglingLineStream().forEach(dl -> addElementNameAlias(dl, duplicatedAliases)); } private  UcteAliasesCreation(); static void createAliases(Network network);  }