Interface RangeChoice

All Superinterfaces:
DensityFunction, Keyed, Registerable<RangeChoice>, Wrapper

@NullMarked @AsOf("3.0.0") public interface RangeChoice extends DensityFunction, Registerable<RangeChoice>
Computes the input value and, depending on whether it falls within [minInclusive, maxExclusive), returns one of two other density functions. Essentially an if-then-else statement.
Since:
3.0.0
See Also:
  • Method Details

    • input

      @AsOf("3.0.0") DensityFunction input()
      The value to compare against the range.
      Returns:
      the input density function
      Since:
      3.0.0
    • minInclusive

      @AsOf("3.0.0") double minInclusive()
      The lower bound of the range, inclusive.
      Returns:
      the minimum inclusive value
      Since:
      3.0.0
    • maxExclusive

      @AsOf("3.0.0") double maxExclusive()
      The upper bound of the range, exclusive.
      Returns:
      the maximum exclusive value
      Since:
      3.0.0
    • whenInRange

      @AsOf("3.0.0") DensityFunction whenInRange()
      The density function used when the input is inside the range.
      Returns:
      the in-range density function
      Since:
      3.0.0
    • whenOutOfRange

      @AsOf("3.0.0") DensityFunction whenOutOfRange()
      The density function used when the input is outside the range.
      Returns:
      the out-of-range density function
      Since:
      3.0.0
    • toBuilder

      @AsOf("3.0.0") default RangeChoice.Builder toBuilder()
      Converts this object back to a builder.
      Returns:
      a builder with the same values as this object
      Since:
      3.0.0
    • of

      @AsOf("3.0.0") static RangeChoice of(@Nullable ResourceKey resourceKey, DensityFunction input, double minInclusive, double maxExclusive, DensityFunction whenInRange, DensityFunction whenOutOfRange)
      Creates a new range choice density function.
      Parameters:
      resourceKey - the resource key, or null
      input - the value to compare against the range
      minInclusive - the lower bound of the range, inclusive
      maxExclusive - the upper bound of the range, exclusive
      whenInRange - the density function used when the input is inside the range
      whenOutOfRange - the density function used when the input is outside the range
      Returns:
      a new range choice density function
      Since:
      3.0.0
    • of

      @AsOf("3.0.0") static RangeChoice of(DensityFunction input, double minInclusive, double maxExclusive, DensityFunction whenInRange, DensityFunction whenOutOfRange)
      Creates a new range choice density function.
      Parameters:
      input - the value to compare against the range
      minInclusive - the lower bound of the range, inclusive
      maxExclusive - the upper bound of the range, exclusive
      whenInRange - the density function used when the input is inside the range
      whenOutOfRange - the density function used when the input is outside the range
      Returns:
      a new range choice density function
      Since:
      3.0.0
    • builder

      @AsOf("3.0.0") static RangeChoice.Builder builder()
      Creates a new builder.
      Returns:
      a new builder
      Since:
      3.0.0