Package net.jqwik.api

Class ShrinkingDistance

  • All Implemented Interfaces:
    java.lang.Comparable<ShrinkingDistance>

    @API(status=STABLE,
         since="1.0")
    public class ShrinkingDistance
    extends java.lang.Object
    implements java.lang.Comparable<ShrinkingDistance>
    A ShrinkingDistance is a measure of how close a value is to the minimum value, aka target value.

    The distance is used during shrinking to determine if a shrunk value is really closer to the target value. If it is not, the value is being discarded.

    • Field Detail

      • MAX

        @API(status=MAINTAINED,
             since="1.2.0")
        public static final ShrinkingDistance MAX
      • MIN

        @API(status=MAINTAINED,
             since="1.7.2")
        public static final ShrinkingDistance MIN
    • Method Detail

      • of

        @API(status=MAINTAINED,
             since="1.0")
        public static ShrinkingDistance of​(long... distances)
        Create a ShrinkingDistance with one or more dimensions.
        Parameters:
        distances - a non-empty array of non-negative values.
        Returns:
        an immutable instance of ShrinkingDistance
      • forCollection

        @API(status=MAINTAINED,
             since="1.0")
        public static <T> ShrinkingDistance forCollection​(java.util.Collection<Shrinkable<T>> elements)
      • combine

        @API(status=MAINTAINED,
             since="1.0")
        public static <T> ShrinkingDistance combine​(java.util.List<Shrinkable<T>> shrinkables)
      • equals

        public boolean equals​(@Nullable
                              @Nullable java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • compareTo

        public int compareTo​(ShrinkingDistance other)
        Compare to distances with each other. No distance can be greater than MAX. No distance can be smaller than MIN.
        Specified by:
        compareTo in interface java.lang.Comparable<ShrinkingDistance>
      • dimensions

        @API(status=INTERNAL)
        public java.util.List<ShrinkingDistance> dimensions()
      • size

        @API(status=INTERNAL)
        public int size()