Class RangeUtil


  • public class RangeUtil
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      RangeUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Long clampMax​(java.lang.Long input, java.lang.Long max)
      Ensures the input value is not greater than the maximum value.
      static java.lang.Long clampMin​(java.lang.Long input, java.lang.Long min)
      Ensures the input value is not less than the minimum value.
      static java.lang.Long returnIfGreater​(java.lang.Long input, java.lang.Long max)
      Ensures the input value is not greater than the maximum value.
      static java.lang.Long returnIfLess​(java.lang.Long input, java.lang.Long min)
      Ensures the input value is not less than the minimum value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RangeUtil

        public RangeUtil()
    • Method Detail

      • clampMin

        public static java.lang.Long clampMin​(java.lang.Long input,
                                              java.lang.Long min)
        Ensures the input value is not less than the minimum value.
        Parameters:
        input - the value to compare
        min - the minimum value
        Returns:
        the greater of input and min
      • clampMax

        public static java.lang.Long clampMax​(java.lang.Long input,
                                              java.lang.Long max)
        Ensures the input value is not greater than the maximum value.
        Parameters:
        input - the value to compare
        max - the maximum value
        Returns:
        the lesser of input and max
      • returnIfLess

        public static java.lang.Long returnIfLess​(java.lang.Long input,
                                                  java.lang.Long min)
        Ensures the input value is not less than the minimum value. If the input value is less than the specified minimum, the input value is returned. Otherwise, the minimum value is returned.
        Parameters:
        input - the value to compare
        min - the minimum value
        Returns:
        the greater of input and min
      • returnIfGreater

        public static java.lang.Long returnIfGreater​(java.lang.Long input,
                                                     java.lang.Long max)
        Ensures the input value is not greater than the maximum value. If the input value is greater than the specified maximum, the input value is returned. Otherwise, the maximum value is returned.
        Parameters:
        input - the value to compare
        max - the maximum value
        Returns:
        the lesser of input and max