Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for constrainToRange (0.06 sec)

  1. guava-tests/test/com/google/common/primitives/ShortsTest.java

      }
    
      public void testConstrainToRange() {
        assertThat(Shorts.constrainToRange((short) 1, (short) 0, (short) 5)).isEqualTo((short) 1);
        assertThat(Shorts.constrainToRange((short) 1, (short) 1, (short) 5)).isEqualTo((short) 1);
        assertThat(Shorts.constrainToRange((short) 1, (short) 3, (short) 5)).isEqualTo((short) 3);
        assertThat(Shorts.constrainToRange((short) 0, (short) -5, (short) -1)).isEqualTo((short) -1);
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Thu Dec 11 20:45:32 UTC 2025
    - 27.5K bytes
    - Viewed (0)
  2. android/guava-tests/test/com/google/common/primitives/CharsTest.java

      }
    
      public void testConstrainToRange() {
        assertThat(Chars.constrainToRange((char) 1, (char) 0, (char) 5)).isEqualTo((char) 1);
        assertThat(Chars.constrainToRange((char) 1, (char) 1, (char) 5)).isEqualTo((char) 1);
        assertThat(Chars.constrainToRange((char) 1, (char) 3, (char) 5)).isEqualTo((char) 3);
        assertThat(Chars.constrainToRange((char) 255, (char) 250, (char) 254)).isEqualTo((char) 254);
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Thu Dec 11 20:45:32 UTC 2025
    - 25.9K bytes
    - Viewed (0)
  3. android/guava-tests/test/com/google/common/primitives/DoublesTest.java

      }
    
      public void testConstrainToRange() {
        assertThat(Doubles.constrainToRange(1.0, 0.0, 5.0)).isEqualTo(1.0);
        assertThat(Doubles.constrainToRange(1.0, 1.0, 5.0)).isEqualTo(1.0);
        assertThat(Doubles.constrainToRange(1.0, 3.0, 5.0)).isEqualTo(3.0);
        assertThat(Doubles.constrainToRange(0.0, -5.0, -1.0)).isEqualTo(-1.0);
        assertThat(Doubles.constrainToRange(5.0, 2.0, 2.0)).isEqualTo(2.0);
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Thu Dec 11 20:45:32 UTC 2025
    - 30.9K bytes
    - Viewed (0)
  4. guava-tests/test/com/google/common/primitives/IntsTest.java

        assertThat(Ints.constrainToRange((int) 1, (int) 0, (int) 5)).isEqualTo((int) 1);
        assertThat(Ints.constrainToRange((int) 1, (int) 1, (int) 5)).isEqualTo((int) 1);
        assertThat(Ints.constrainToRange((int) 1, (int) 3, (int) 5)).isEqualTo((int) 3);
        assertThat(Ints.constrainToRange((int) 0, (int) -5, (int) -1)).isEqualTo((int) -1);
        assertThat(Ints.constrainToRange((int) 5, (int) 2, (int) 2)).isEqualTo((int) 2);
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Thu Dec 11 20:45:32 UTC 2025
    - 29.3K bytes
    - Viewed (0)
  5. guava/src/com/google/common/primitives/Shorts.java

       * @param max the upper bound (inclusive) of the range to constrain {@code value} to
       * @throws IllegalArgumentException if {@code min > max}
       * @since 21.0
       */
      public static short constrainToRange(short value, short min, short max) {
        checkArgument(min <= max, "min (%s) must be less than or equal to max (%s)", min, max);
        return value < min ? min : value < max ? value : max;
      }
    
      /**
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Wed Oct 22 18:14:49 UTC 2025
    - 25.7K bytes
    - Viewed (0)
  6. android/guava/src/com/google/common/primitives/Shorts.java

       * @param max the upper bound (inclusive) of the range to constrain {@code value} to
       * @throws IllegalArgumentException if {@code min > max}
       * @since 21.0
       */
      public static short constrainToRange(short value, short min, short max) {
        checkArgument(min <= max, "min (%s) must be less than or equal to max (%s)", min, max);
        return value < min ? min : value < max ? value : max;
      }
    
      /**
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Wed Oct 22 18:14:49 UTC 2025
    - 25.7K bytes
    - Viewed (0)
  7. android/guava/src/com/google/common/primitives/Ints.java

       * @since 21.0
       */
      // A call to bare "min" or "max" would resolve to our varargs method, not to any static import.
      @SuppressWarnings("StaticImportPreferred")
      public static int constrainToRange(int value, int min, int max) {
        checkArgument(min <= max, "min (%s) must be less than or equal to max (%s)", min, max);
        return Math.min(Math.max(value, min), max);
      }
    
      /**
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Wed Oct 22 18:14:49 UTC 2025
    - 31.3K bytes
    - Viewed (0)
  8. guava/src/com/google/common/primitives/Floats.java

       * @param max the upper bound (inclusive) of the range to constrain {@code value} to
       * @throws IllegalArgumentException if {@code min > max}
       * @since 21.0
       */
      public static float constrainToRange(float value, float min, float max) {
        // avoid auto-boxing by not using Preconditions.checkArgument(); see Guava issue 3984
        // Reject NaN by testing for the good case (min <= max) instead of the bad (min > max).
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Wed Oct 22 18:14:49 UTC 2025
    - 25.6K bytes
    - Viewed (0)
  9. android/guava/src/com/google/common/primitives/Longs.java

       * @param max the upper bound (inclusive) of the range to constrain {@code value} to
       * @throws IllegalArgumentException if {@code min > max}
       * @since 21.0
       */
      public static long constrainToRange(long value, long min, long max) {
        checkArgument(min <= max, "min (%s) must be less than or equal to max (%s)", min, max);
        return Math.min(Math.max(value, min), max);
      }
    
      /**
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Wed Oct 22 18:14:49 UTC 2025
    - 29K bytes
    - Viewed (0)
  10. guava/src/com/google/common/primitives/Doubles.java

       * @param max the upper bound (inclusive) of the range to constrain {@code value} to
       * @throws IllegalArgumentException if {@code min > max}
       * @since 21.0
       */
      public static double constrainToRange(double value, double min, double max) {
        // avoid auto-boxing by not using Preconditions.checkArgument(); see Guava issue 3984
        // Reject NaN by testing for the good case (min <= max) instead of the bad (min > max).
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Wed Oct 22 18:14:49 UTC 2025
    - 27.6K bytes
    - Viewed (0)
Back to top