Class BenchmarkContext
java.lang.Object
com.github.rlacher.sortbench.results.BenchmarkContext
- All Implemented Interfaces:
Comparable<BenchmarkContext>
Represents the contextual parameters of a benchmark run.
This class encapsulates the data type, data length, and sorting algorithm
used during a benchmark execution. Instances of this class are used to
create BenchmarkResult and AggregatedResult objects.
This class is immutable, ensuring that context parameters cannot be modified after creation.
-
Constructor Summary
ConstructorsConstructorDescriptionBenchmarkContext(BenchmarkData.DataType dataType, int dataLength, String sortStrategyName) Constructs a new BenchmarkContext object. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(BenchmarkContext other) Compares thisBenchmarkContextfor order: dataType, dataLength, sortStrategyName.booleanIndicates whether some other object is "equal to" this one.intGets the data length.Gets the data type.Gets the sort strategy name.inthashCode()Returns a hash code value for the object.toString()Returns a string representation of theBenchmarkContextobject.
-
Constructor Details
-
BenchmarkContext
Constructs a new BenchmarkContext object.- Parameters:
dataType- The type of input data.dataLength- The length of the input data.sortStrategyName- The name of the sorting strategy.- Throws:
IllegalArgumentException- If dataType or sortStrategyName arenull, or dataLength is negative.
-
-
Method Details
-
getDataType
Gets the data type.- Returns:
- The data type.
-
getDataLength
public int getDataLength()Gets the data length.- Returns:
- The data length.
-
getSortStrategyName
Gets the sort strategy name.- Returns:
- The sort strategy name.
-
toString
Returns a string representation of theBenchmarkContextobject. -
equals
Indicates whether some other object is "equal to" this one. -
hashCode
public int hashCode()Returns a hash code value for the object. -
compareTo
Compares thisBenchmarkContextfor order: dataType, dataLength, sortStrategyName.- Specified by:
compareToin interfaceComparable<BenchmarkContext>- Parameters:
other- TheBenchmarkContextto be compared with.- Returns:
- Negative, zero, or positive integer for less, equal, or greater.
- Throws:
IllegalArgumentException- If other isnull.
-