reduceToInterval

fun ProgressReporter.reduceToInterval(min: Double, max: Double, treatDoneAs: Progress.Loading.Quantified = defaultDone, treatUnquantifiedAs: Progress.Loading.Quantified = defaultUnquantified): ProgressReporter(source)

Creates a new reporter that proportionally confines progress events to the min..max range.

Parameters

treatDoneAs

When a Progress.Done is received, it will be treated as if that value was received.

treatUnquantifiedAs

When a Progress.Loading.Unquantified is received, it will be treated as if that value was received.


fun ProgressReporter.reduceToInterval(interval: ClosedFloatingPointRange<Double>, treatDoneAs: Progress.Loading.Quantified = defaultDone, treatUnquantifiedAs: Progress.Loading.Quantified = defaultUnquantified): ProgressReporter(source)

Creates a new reporter that proportionally confines progress events to interval.

Example usage:

val reporter = ProgressReporter { println(it) }
.reduceToInterval(0.2..0.4)

reporter.report(loading(0.1)) // prints 'Loading(22%)'

Parameters

treatDoneAs

When a Progress.Done is received, it will be treated as if that value was received.

treatUnquantifiedAs

When a Progress.Loading.Unquantified is received, it will be treated as if that value was received.