com.emc.mongoose.api.common.supply.async.AsyncRangeDefinedLongFormattingSupplier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mongoose-api-common Show documentation
Show all versions of mongoose-api-common Show documentation
Mongoose is a high-load storage performance testing tool
package com.emc.mongoose.api.common.supply.async;
import com.emc.mongoose.api.common.exception.OmgDoesNotPerformException;
import com.github.akurilov.coroutines.CoroutinesProcessor;
import java.text.DecimalFormat;
import java.text.NumberFormat;
public final class AsyncRangeDefinedLongFormattingSupplier
extends AsyncRangeDefinedSupplierBase {
private final NumberFormat format;
public AsyncRangeDefinedLongFormattingSupplier(
final CoroutinesProcessor coroutinesProcessor,
final long seed, final long minValue, final long maxValue, final String formatStr
) throws OmgDoesNotPerformException {
super(coroutinesProcessor, seed, minValue, maxValue);
this.format = formatStr == null || formatStr.isEmpty() ?
null : new DecimalFormat(formatStr);
}
@Override
protected final Long computeRange(final Long minValue, final Long maxValue) {
return maxValue - minValue + 1;
}
@Override
protected final Long rangeValue() {
return minValue() + rnd.nextLong(range());
}
@Override
protected final Long singleValue() {
return rnd.nextLong();
}
@Override
protected String toString(final Long value) {
return format == null ? value.toString() : format.format(value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy