class NetworkSamplesGenerator {

    public Stream<NetworkSample> stream() {

        StatusBar statusBar = statusBarSupplier.get();

        dropSamples(dropCount, statusBar);

        final AtomicInteger sampleNumber = new AtomicInteger(0);
        return Stream.generate(() -> {

            sampleNumber.getAndIncrement();

            for (int i = 0; i < downSampleInterval - 1; i++) {
                algorithm.step();
            }

            NetworkSample sample = algorithm.sample();
            statusBar.setMessage(String.format("Sample #%,d completed", sampleNumber.get()));
            return sample;

        }).onClose(statusBar::finish);
    }

    public  NetworkSamplesGenerator(SamplingAlgorithm algorithm, Supplier<StatusBar> statusBarSupplier);

}