java.lang.Object
io.nosqlbench.virtdata.library.basics.shared.from_long.to_long.HashInterval
All Implemented Interfaces:
java.util.function.LongUnaryOperator

public class HashInterval
extends java.lang.Object
implements java.util.function.LongUnaryOperator
Return a value within a range, pseudo-randomly, using interval semantics, where the range of values return does not include the last value. This function behaves exactly like HashRange except for the exclusion of the last value. This allows you to stack intervals using known reference points without duplicating or skipping any given value. You can specify hash intervals as small as a single-element range, like (5,6), or as wide as the relevant data type allows.
  • Constructor Summary

    Constructors
    Constructor Description
    HashInterval​(long width)
    Create a hash interval based on a minimum value of 0 and a specified width.
    HashInterval​(long minIncl, long maxExcl)
    Create a hash interval
  • Method Summary

    Modifier and Type Method Description
    long applyAsLong​(long operand)  

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface java.util.function.LongUnaryOperator

    andThen, compose
  • Constructor Details

    • HashInterval

      public HashInterval​(long width)
      Create a hash interval based on a minimum value of 0 and a specified width.
      Parameters:
      width - The maximum value, which is excluded.
    • HashInterval

      public HashInterval​(long minIncl, long maxExcl)
      Create a hash interval
      Parameters:
      minIncl - The minimum value, which is included
      maxExcl - The maximum value, which is excluded
  • Method Details

    • applyAsLong

      public long applyAsLong​(long operand)
      Specified by:
      applyAsLong in interface java.util.function.LongUnaryOperator