@Test public void testEmptyLastCharacterOfLineImport() { ResourceDataSource dataSource = new ResourceDataSource("lastCharacterIssue", new ResourceSet("/", "lastCharacterIssue.uct")); Network network = new UcteImporter().importData(dataSource, null); assertEquals(2, network.getBusBreakerView().getBusStream().count()); }
@Override public Network importData(ReadOnlyDataSource dataSource, NetworkFactory networkFactory, Properties parameters) { try { String ext = findExtension(dataSource, true); try (BufferedReader reader = new BufferedReader(new InputStreamReader(dataSource.newInputStream(null, ext)))) { Stopwatch stopwatch = Stopwatch.createStarted(); UcteNetworkExt ucteNetwork = new UcteNetworkExt(new UcteReader().read(reader), LINE_MIN_Z); String fileName = dataSource.getBaseName(); EntsoeFileName ucteFileName = EntsoeFileName.parse(fileName); Network network = networkFactory.createNetwork(fileName, "UCTE"); network.setCaseDate(ucteFileName.getDate()); network.setForecastDistance(ucteFileName.getForecastDistance()); createBuses(ucteNetwork, network); createLines(ucteNetwork, network); createTransformers(ucteNetwork, network, ucteFileName); mergeXnodeDanglingLines(ucteNetwork, network); stopwatch.stop(); LOGGER.debug("UCTE import done in {} ms", stopwatch.elapsed(TimeUnit.MILLISECONDS)); return network; } } catch (IOException e) { throw new UncheckedIOException(e); } }
UcteImporter implements Importer { @Override public Network importData(ReadOnlyDataSource dataSource, NetworkFactory networkFactory, Properties parameters) { try { String ext = findExtension(dataSource, true); try (BufferedReader reader = new BufferedReader(new InputStreamReader(dataSource.newInputStream(null, ext)))) { Stopwatch stopwatch = Stopwatch.createStarted(); UcteNetworkExt ucteNetwork = new UcteNetworkExt(new UcteReader().read(reader), LINE_MIN_Z); String fileName = dataSource.getBaseName(); EntsoeFileName ucteFileName = EntsoeFileName.parse(fileName); Network network = networkFactory.createNetwork(fileName, "UCTE"); network.setCaseDate(ucteFileName.getDate()); network.setForecastDistance(ucteFileName.getForecastDistance()); createBuses(ucteNetwork, network); createLines(ucteNetwork, network); createTransformers(ucteNetwork, network, ucteFileName); mergeXnodeDanglingLines(ucteNetwork, network); stopwatch.stop(); LOGGER.debug("UCTE import done in {} ms", stopwatch.elapsed(TimeUnit.MILLISECONDS)); return network; } } catch (IOException e) { throw new UncheckedIOException(e); } } }
UcteImporter implements Importer { @Override public Network importData(ReadOnlyDataSource dataSource, NetworkFactory networkFactory, Properties parameters) { try { String ext = findExtension(dataSource, true); try (BufferedReader reader = new BufferedReader(new InputStreamReader(dataSource.newInputStream(null, ext)))) { Stopwatch stopwatch = Stopwatch.createStarted(); UcteNetworkExt ucteNetwork = new UcteNetworkExt(new UcteReader().read(reader), LINE_MIN_Z); String fileName = dataSource.getBaseName(); EntsoeFileName ucteFileName = EntsoeFileName.parse(fileName); Network network = networkFactory.createNetwork(fileName, "UCTE"); network.setCaseDate(ucteFileName.getDate()); network.setForecastDistance(ucteFileName.getForecastDistance()); createBuses(ucteNetwork, network); createLines(ucteNetwork, network); createTransformers(ucteNetwork, network, ucteFileName); mergeXnodeDanglingLines(ucteNetwork, network); stopwatch.stop(); LOGGER.debug("UCTE import done in {} ms", stopwatch.elapsed(TimeUnit.MILLISECONDS)); return network; } } catch (IOException e) { throw new UncheckedIOException(e); } }  }
UcteImporter implements Importer { @Override public Network importData(ReadOnlyDataSource dataSource, NetworkFactory networkFactory, Properties parameters) { try { String ext = findExtension(dataSource, true); try (BufferedReader reader = new BufferedReader(new InputStreamReader(dataSource.newInputStream(null, ext)))) { Stopwatch stopwatch = Stopwatch.createStarted(); UcteNetworkExt ucteNetwork = new UcteNetworkExt(new UcteReader().read(reader), LINE_MIN_Z); String fileName = dataSource.getBaseName(); EntsoeFileName ucteFileName = EntsoeFileName.parse(fileName); Network network = networkFactory.createNetwork(fileName, "UCTE"); network.setCaseDate(ucteFileName.getDate()); network.setForecastDistance(ucteFileName.getForecastDistance()); createBuses(ucteNetwork, network); createLines(ucteNetwork, network); createTransformers(ucteNetwork, network, ucteFileName); mergeXnodeDanglingLines(ucteNetwork, network); stopwatch.stop(); LOGGER.debug("UCTE import done in {} ms", stopwatch.elapsed(TimeUnit.MILLISECONDS)); return network; } } catch (IOException e) { throw new UncheckedIOException(e); } }  @Override String getFormat(); @Override String getComment(); @Override boolean exists(ReadOnlyDataSource dataSource); @Override void copy(ReadOnlyDataSource fromDataSource, DataSource toDataSource); @Override Network importData(ReadOnlyDataSource dataSource, NetworkFactory networkFactory, Properties parameters); }
UcteImporter implements Importer { @Override public Network importData(ReadOnlyDataSource dataSource, NetworkFactory networkFactory, Properties parameters) { try { String ext = findExtension(dataSource, true); try (BufferedReader reader = new BufferedReader(new InputStreamReader(dataSource.newInputStream(null, ext)))) { Stopwatch stopwatch = Stopwatch.createStarted(); UcteNetworkExt ucteNetwork = new UcteNetworkExt(new UcteReader().read(reader), LINE_MIN_Z); String fileName = dataSource.getBaseName(); EntsoeFileName ucteFileName = EntsoeFileName.parse(fileName); Network network = networkFactory.createNetwork(fileName, "UCTE"); network.setCaseDate(ucteFileName.getDate()); network.setForecastDistance(ucteFileName.getForecastDistance()); createBuses(ucteNetwork, network); createLines(ucteNetwork, network); createTransformers(ucteNetwork, network, ucteFileName); mergeXnodeDanglingLines(ucteNetwork, network); stopwatch.stop(); LOGGER.debug("UCTE import done in {} ms", stopwatch.elapsed(TimeUnit.MILLISECONDS)); return network; } } catch (IOException e) { throw new UncheckedIOException(e); } }  @Override String getFormat(); @Override String getComment(); @Override boolean exists(ReadOnlyDataSource dataSource); @Override void copy(ReadOnlyDataSource fromDataSource, DataSource toDataSource); @Override Network importData(ReadOnlyDataSource dataSource, NetworkFactory networkFactory, Properties parameters);  }