Class BucketedSort.ForFloats

java.lang.Object
org.elasticsearch.search.sort.BucketedSort
org.elasticsearch.search.sort.BucketedSort.ForFloats
All Implemented Interfaces:
Closeable, AutoCloseable, org.elasticsearch.core.Releasable
Enclosing class:
BucketedSort

public abstract static class BucketedSort.ForFloats extends BucketedSort
Superclass for implementations of BucketedSort for float keys.
  • Field Details

    • MAX_BUCKET_SIZE

      public static final int MAX_BUCKET_SIZE
      The maximum size of buckets this can store. This is because we store the next offset to write to in a float and floats only have 23 bits of mantissa so they can't accurate store values higher than 2 ^ 24.
  • Constructor Details

  • Method Details

    • values

      protected final BigArray values()
      Description copied from class: BucketedSort
      The BigArray backing this sort.
      Specified by:
      values in class BucketedSort
    • growValues

      protected final void growValues(long minSize)
      Description copied from class: BucketedSort
      Grow the BigArray backing this sort to account for new buckets. This will only be called if the array is too small.
      Specified by:
      growValues in class BucketedSort
    • getNextGatherOffset

      protected final int getNextGatherOffset(long rootIndex)
      Description copied from class: BucketedSort
      Get the next index that should be "gathered" for a bucket rooted at rootIndex.
      Specified by:
      getNextGatherOffset in class BucketedSort
    • setNextGatherOffset

      protected final void setNextGatherOffset(long rootIndex, int offset)
      Description copied from class: BucketedSort
      Set the next index that should be "gathered" for a bucket rooted at rootIndex.
      Specified by:
      setNextGatherOffset in class BucketedSort
    • getValue

      protected final SortValue getValue(long index)
      Description copied from class: BucketedSort
      Get the value at an index.
      Specified by:
      getValue in class BucketedSort
    • betterThan

      protected final boolean betterThan(long lhs, long rhs)
      Description copied from class: BucketedSort
      true if the entry at index lhs is "better" than the entry at rhs. "Better" in this means "lower" for SortOrder.ASC and "higher" for SortOrder.DESC.
      Specified by:
      betterThan in class BucketedSort
    • swap

      protected final void swap(long lhs, long rhs)
      Description copied from class: BucketedSort
      Swap the data at two indices.
      Specified by:
      swap in class BucketedSort