com.emc.mongoose.common.supply.async.AsyncRangeDefinedDateFormattingSupplier 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 com.emc.mongoose.common.supply.RangeDefinedSupplier;
import org.apache.commons.lang.time.FastDateFormat;
import java.text.Format;
import java.util.Date;
public final class AsyncRangeDefinedDateFormattingSupplier
extends AsyncRangeDefinedSupplierBase {
private final Format format;
private final RangeDefinedSupplier longGenerator;
public AsyncRangeDefinedDateFormattingSupplier(
final long seed, final Date minValue, final Date maxValue, final String formatString
) throws OmgDoesNotPerformException{
super(seed, minValue, maxValue);
this.format = formatString == null || formatString.isEmpty() ?
null : FastDateFormat.getInstance(formatString);
longGenerator = new AsyncRangeDefinedLongFormattingSupplier(
seed, minValue.getTime(), maxValue.getTime(), null
);
}
@Override
protected final Date computeRange(final Date minValue, final Date maxValue) {
return null;
}
@Override
protected final Date rangeValue() {
return new Date(longGenerator.value());
}
@Override
protected final Date singleValue() {
return new Date(longGenerator.value());
}
@Override
protected final String toString(final Date value) {
return format == null ? value.toString() : format.format(value);
}
@Override
public final boolean isInitialized() {
return longGenerator != null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy