Package ej.bon

## Class XMath

- java.lang.Object
- - ej.bon.XMath

-     public final class XMath
      extends Object

  This class provides advanced mathematical functions.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `XMath()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static double` | `limit​(double value, double min, double max)` | Limits a value between two others: If `value` is lower than `min`, returns `min`. If `value` is greater than `max`, returns `max`. Otherwise, returns `value`.
    `static float` | `limit​(float value, float min, float max)` | Limits a value between two others: If `value` is lower than `min`, returns `min`. If `value` is greater than `max`, returns `max`. Otherwise, returns `value`.
    `static int` | `limit​(int value, int min, int max)` | Limits a value between two others: If `value` is lower than `min`, returns `min`. If `value` is greater than `max`, returns `max`. Otherwise, returns `value`.
    `static long` | `limit​(long value, long min, long max)` | Limits a value between two others: If `value` is lower than `min`, returns `min`. If `value` is greater than `max`, returns `max`. Otherwise, returns `value`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XMath

          public XMath()

  - ### Method Detail

    - #### limit

          public static int limit​(int value,
                                  int min,
                                  int max)

      Limits a value between two others:
      1. If `value` is lower than `min`, returns `min`.
      2. If `value` is greater than `max`, returns `max`.
      3. Otherwise, returns `value`.
      Parameters:
        `value` - the value to limit
        `min` - the lower bound
        `max` - the upper bound
      Returns:
        the limited value
      Throws:
        `IllegalArgumentException` - if `min` is greater than `max`

    - #### limit

          public static float limit​(float value,
                                    float min,
                                    float max)

      Limits a value between two others:
      1. If `value` is lower than `min`, returns `min`.
      2. If `value` is greater than `max`, returns `max`.
      3. Otherwise, returns `value`.
      Parameters:
        `value` - the value to limit
        `min` - the lower bound
        `max` - the upper bound
      Returns:
        the limited value
      Throws:
        `IllegalArgumentException` - if `min` is greater than `max`

    - #### limit

          public static long limit​(long value,
                                   long min,
                                   long max)

      Limits a value between two others:
      1. If `value` is lower than `min`, returns `min`.
      2. If `value` is greater than `max`, returns `max`.
      3. Otherwise, returns `value`.
      Parameters:
        `value` - the value to limit
        `min` - the lower bound
        `max` - the upper bound
      Returns:
        the limited value
      Throws:
        `IllegalArgumentException` - if `min` is greater than `max`

    - #### limit

          public static double limit​(double value,
                                     double min,
                                     double max)

      Limits a value between two others:
      1. If `value` is lower than `min`, returns `min`.
      2. If `value` is greater than `max`, returns `max`.
      3. Otherwise, returns `value`.
      Parameters:
        `value` - the value to limit
        `min` - the lower bound
        `max` - the upper bound
      Returns:
        the limited value
      Throws:
        `IllegalArgumentException` - if `min` is greater than `max`