Class BenchmarkDataFactory
java.lang.Object
com.github.rlacher.sortbench.benchmark.data.BenchmarkDataFactory
Factory class for creating benchmark data for sorting algorithm benchmark.
-
Method Summary
Modifier and TypeMethodDescriptionstatic BenchmarkDatacreateData(BenchmarkData.DataType dataType, int dataLength) Creates benchmark data of the specified type and length.static voidSets the random instance for benchmark data generation or testing purposes.
-
Method Details
-
setRandom
Sets the random instance for benchmark data generation or testing purposes.- Parameters:
random- The random instance to be set.- Throws:
IllegalArgumentException- If the provided random instance isnull.
-
createData
Creates benchmark data of the specified type and length.This is the single entry point for generating benchmark data using this factory. All requests for benchmark data should be made through this method.
- Parameters:
dataType- The type of benchmark data to create.dataLength- The desired length of the benchmark data. Must be a positive integer.- Returns:
- An instance of
BenchmarkDatacontaining the generated data. - Throws:
IllegalArgumentException- If thedataLengthis not positive.IllegalStateException- If an unknowndataTypeis provided.
-