@Test public void checkAliasesCreationWhenImportingMergedFile() { Network network = loadNetworkFromResourceFile("/uxTestGridForMerging.uct"); assertNull(network.getIdentifiable("BBBBBB11 XXXXXX11 1")); assertNull(network.getIdentifiable("FFFFFF11 XXXXXX11 1")); assertNull(network.getIdentifiable("BBBBBB11 XXXXXX11 ABCDE")); assertNull(network.getIdentifiable("FFFFFF11 XXXXXX11 ABCDE")); assertNull(network.getIdentifiable("BBBBBB11 XXXXXX11 1")); assertNull(network.getIdentifiable("FFFFFF11 XXXXXX11 1")); UcteAliasesCreation.createAliases(network); assertNotNull(network.getIdentifiable("BBBBBB11 XXXXXX11 ABCDE")); assertNotNull(network.getIdentifiable("FFFFFF11 XXXXXX11 ABCDE")); assertNotNull(network.getIdentifiable("BBBBBB11 XXXXXX11 1")); assertNotNull(network.getIdentifiable("FFFFFF11 XXXXXX11 1")); assertEquals(network.getIdentifiable("BBBBBB11 XXXXXX11 ABCDE"), network.getIdentifiable("FFFFFF11 XXXXXX11 ABCDE")); assertEquals(network.getIdentifiable("BBBBBB11 XXXXXX11 ABCDE"), network.getIdentifiable("BBBBBB11 XXXXXX11 1")); assertEquals(network.getIdentifiable("FFFFFF11 XXXXXX11 ABCDE"), network.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);  }