Class AggregatedResult

java.lang.Object
com.github.rlacher.sortbench.results.AggregatedResult
All Implemented Interfaces:
Comparable<AggregatedResult>

public final class AggregatedResult extends Object implements Comparable<AggregatedResult>
Represents the aggregated result of a benchmark run, derived from multiple BenchmarkResult instances.

This class encapsulates the aggregated benchmark result produced by the ResultAggregator, associating it with a specific BenchmarkContext and Benchmarker.ProfilingMode.

  • Constructor Details

    • AggregatedResult

      public AggregatedResult(BenchmarkContext context, Benchmarker.ProfilingMode profilingMode, double aggregate, int iterations)
      Constructs a new AggregatedResult object.
      Parameters:
      context - The benchmark context. Must not be null.
      profilingMode - The profiling mode. Must not be null.
      aggregate - The aggregated metric value. Must not be negative.
      iterations - The number of iterations. Must not be negative.
      Throws:
      IllegalArgumentException - If context or profilingMode are null, or aggregate or iterations are negative.
  • Method Details

    • compareTo

      public int compareTo(AggregatedResult other)
      Defines the natural comparison logic for AggregatedResult.
      Specified by:
      compareTo in interface Comparable<AggregatedResult>
      Parameters:
      other - The aggregated result to be compared.
      Returns:
      A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
      Throws:
      IllegalArgumentException - if the specified object is null.
    • getContext

      public BenchmarkContext getContext()
      Gets the benchmark context.
      Returns:
      The benchmark context object.
    • getProfilingMode

      public Benchmarker.ProfilingMode getProfilingMode()
      Gets the profiling mode.
      Returns:
      The profiling mode.
    • getAggregate

      public double getAggregate()
      Gets the aggregated metric value.
      Returns:
      The aggregate value.
    • getIterations

      public int getIterations()
      Gets the number of iterations.
      Returns:
      The number of iterations.
    • toString

      public String toString()
      Returns a string representation of the AggregatedResult object.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the object.
    • equals

      public boolean equals(Object obj)
      Indicates whether some other object is "equal to" this one.
      Overrides:
      equals in class Object
      Parameters:
      obj - The object with which to compare.
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for the object.
      Overrides:
      hashCode in class Object
      Returns:
      A hash code value for this object.