Class MathTools

java.lang.Object
impl.org.controlsfx.tools.MathTools

public class MathTools extends Object
Contains methods Math might also contain but doesn't.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    inInterval(double lowerBound, double value, double upperBound)
    Checks whether the specified value lies in the closed interval defined by the specified bounds.
    static boolean
    isInInterval(double lowerBound, double value, double upperBound)
    Checks whether the specified value lies in the closed interval defined by the specified bounds.
    static double
    min(double... values)
    Returns the smallest value in the specified array according to Math.min(double, double).

    Methods inherited from class java.lang.Object

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

    • MathTools

      public MathTools()
  • Method Details

    • isInInterval

      public static boolean isInInterval(double lowerBound, double value, double upperBound)
      Checks whether the specified value lies in the closed interval defined by the specified bounds.
      Parameters:
      lowerBound - the interval's lower bound; included in the interval
      value - the value which will be checked
      upperBound - the interval's upper bound; included in the interval
      Returns:
      true if lowerBound <= value <= upperBound
      false otherwise
    • inInterval

      public static double inInterval(double lowerBound, double value, double upperBound)
      Checks whether the specified value lies in the closed interval defined by the specified bounds. If it does, it is returned; otherwise the bound closer to the value will be returned.
      Parameters:
      lowerBound - the interval's lower bound; included in the interval
      value - the value which will be checked
      upperBound - the interval's upper bound; included in the interval
      Returns:
      value if lowerBound <= value <= upperBound
      lowerBound if value < lowerBound
      upperBound if upperBound < value
    • min

      public static double min(double... values)
      Returns the smallest value in the specified array according to Math.min(double, double).
      Parameters:
      values - a non-null, non-empty array of double values
      Returns:
      a value from the array which is smaller then or equal to any other value from the array
      Throws:
      NullPointerException - if the values array is null
      IllegalArgumentException - if the values array is empty (i.e. has length 0)