com.emc.mongoose.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-common Show documentation
Show all versions of mongoose-common Show documentation
Mongoose is a high-load storage performance testing tool
The newest version!
package com.emc.mongoose.common.supply.async;
import com.emc.mongoose.common.exception.OmgDoesNotPerformException;
import java.text.DecimalFormat;
import java.text.NumberFormat;
public final class AsyncRangeDefinedLongFormattingSupplier
extends AsyncRangeDefinedSupplierBase {
private final NumberFormat format;
public AsyncRangeDefinedLongFormattingSupplier(
final long seed, final long minValue, final long maxValue, final String formatStr
) throws OmgDoesNotPerformException {
super(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