org.apache.jmeter.report.processor

## Class FieldSampleComparator

- java.lang.Object
- - org.apache.jmeter.report.processor.FieldSampleComparator

- All Implemented Interfaces:
    SampleComparator

      public class FieldSampleComparator
      extends Object
      implements SampleComparator

  Since:
    3.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FieldSampleComparator(String fieldName)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `compare(Sample s1, Sample s2)` Compares to sample
    `void` | `initialize(SampleMetadata metadata)` Initializes the comparator with the `SampleMetadata` of the samples to be compared.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FieldSampleComparator

          public FieldSampleComparator(String fieldName)

  - ### Method Detail

    - #### initialize

          public final void initialize(SampleMetadata metadata)

      Description copied from interface: `SampleComparator`
      Initializes the comparator with the `SampleMetadata` of the samples to be compared.

      This function is invoked before any call to the`compare` service.

      Not that this function is the place to get sample column indexes for better performance

      Specified by:
        `initialize` in interface `SampleComparator`
      Parameters:
        `metadata` - The metadata of the sample to be compared by this instance

    - #### compare

          public long compare(Sample s1,
                              Sample s2)

      Description copied from interface: `SampleComparator`
      Compares to sample

      Must return an long integer that define the relational order of the 2 compared samples:

      - Negative long integer : s1 is lower than s2
      - Zero long integer : s1 is strictly equal to s2
      - Positive long integer : s1 is greater than s2
      Specified by:
        `compare` in interface `SampleComparator`
      Parameters:
        `s1` - The first sample to be compared
        `s2` - The second sample to compared
      Returns:
        A negative is `s1 < s2`, `0 if s1 = s2`, a positive integer if `s1 > s2`

Copyright © 1998-2022 Apache Software Foundation. All Rights Reserved.