Class BenchmarkDataFactory

java.lang.Object
com.github.rlacher.sortbench.benchmark.data.BenchmarkDataFactory

public class BenchmarkDataFactory extends Object
Factory class for creating benchmark data for sorting algorithm benchmark.
  • Method Details

    • setRandom

      public static void setRandom(Random random)
      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 is null.
    • createData

      public static BenchmarkData createData(BenchmarkData.DataType dataType, int dataLength)
      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 BenchmarkData containing the generated data.
      Throws:
      IllegalArgumentException - If the dataLength is not positive.
      IllegalStateException - If an unknown dataType is provided.