Class Arguments

java.lang.Object
org.apache.commons.statistics.inference.Arguments

final class Arguments extends Object
Argument validation methods.
Since:
1.1
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final int
    Two.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    No instances.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static void
    checkCategoriesRequiredSize(int size, int required)
    Check the categories size is the minimum required, size >= required.
    (package private) static double
    checkFinite(double v)
    Check that the value is finite.
    (package private) static void
    checkNonNaN(double[] values)
    Check that all values are not Double.NaN.
    (package private) static void
    checkNonNegative(double v)
    Check that the value is >= 0.
    (package private) static int
    Check that the value is >= 0.
    (package private) static void
    checkNonNegative(long[] values)
    Check that all values are >= 0.
    (package private) static void
    checkNonNegative(long[][] values)
    Check that all values are >= 0.
    (package private) static <E extends Enum<E>>
    E
    checkOption(E v, Set<E> allowed)
    Check the option is allowed.
    (package private) static void
    checkRectangular(long[][] array)
    Checks if the input array is rectangular.
    (package private) static void
    checkSignificance(double alpha)
    Check the significance level is in the correct range.
    (package private) static double
    Check that value is > 0.
    (package private) static void
    checkStrictlyPositive(double[] values)
    Check that all values are > 0.
    (package private) static int
    Check that value is > 0.
    (package private) static void
    checkTable(int[][] table)
    Check the input is a 2-by-2 contingency table.
    (package private) static void
    checkValuesRequiredSize(int size, int required)
    Check the values size is the minimum required, size >= required.
    (package private) static void
    checkValuesSizeMatch(int size1, int size2)
    Check the values sizes are equal, size1 == size2.

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • Arguments

      private Arguments()
      No instances.
  • Method Details

    • checkSignificance

      static void checkSignificance(double alpha)
      Check the significance level is in the correct range.
      Parameters:
      alpha - Significance level of the test.
      Throws:
      IllegalArgumentException - if alpha is not in the range (0, 0.5]
    • checkNonNegative

      static int checkNonNegative(int v)
      Check that the value is >= 0.
      Parameters:
      v - Value to be tested.
      Returns:
      the value
      Throws:
      IllegalArgumentException - if the value is less than 0.
    • checkNonNegative

      static void checkNonNegative(double v)
      Check that the value is >= 0.
      Parameters:
      v - Value to be tested.
      Throws:
      IllegalArgumentException - if the value is less than 0.
    • checkNonNegative

      static void checkNonNegative(long[] values)
      Check that all values are >= 0.
      Parameters:
      values - Values to be tested.
      Throws:
      IllegalArgumentException - if any values are less than 0.
    • checkNonNegative

      static void checkNonNegative(long[][] values)
      Check that all values are >= 0.
      Parameters:
      values - Values to be tested.
      Throws:
      IllegalArgumentException - if any values are less than 0.
    • checkStrictlyPositive

      static int checkStrictlyPositive(int v)
      Check that value is > 0.
      Parameters:
      v - Value to be tested.
      Returns:
      the value
      Throws:
      IllegalArgumentException - if the value is not strictly positive.
    • checkStrictlyPositive

      static double checkStrictlyPositive(double v)
      Check that value is > 0.
      Parameters:
      v - Value to be tested.
      Returns:
      the value
      Throws:
      IllegalArgumentException - if the value is not strictly positive.
    • checkStrictlyPositive

      static void checkStrictlyPositive(double[] values)
      Check that all values are > 0.
      Parameters:
      values - Values to be tested.
      Throws:
      IllegalArgumentException - if any values are not strictly positive.
    • checkFinite

      static double checkFinite(double v)
      Check that the value is finite.
      Parameters:
      v - Value to be tested.
      Returns:
      the value
      Throws:
      IllegalArgumentException - if the value is not finite.
    • checkNonNaN

      static void checkNonNaN(double[] values)
      Check that all values are not Double.NaN.
      Parameters:
      values - Values to be tested.
      Throws:
      IllegalArgumentException - if any values are NaN.
    • checkRectangular

      static void checkRectangular(long[][] array)
      Checks if the input array is rectangular. It is assumed the array is non-null and has a non-zero length.
      Parameters:
      array - Array to be tested.
      Throws:
      NullPointerException - if input array is null
      IndexOutOfBoundsException - if input array is zero length
      IllegalArgumentException - if input array is not rectangular
    • checkValuesRequiredSize

      static void checkValuesRequiredSize(int size, int required)
      Check the values size is the minimum required, size >= required.
      Parameters:
      size - Values size.
      required - Required size.
      Throws:
      IllegalArgumentException - if size < required
    • checkCategoriesRequiredSize

      static void checkCategoriesRequiredSize(int size, int required)
      Check the categories size is the minimum required, size >= required.
      Parameters:
      size - Values size.
      required - Required size.
      Throws:
      IllegalArgumentException - if size < required
    • checkValuesSizeMatch

      static void checkValuesSizeMatch(int size1, int size2)
      Check the values sizes are equal, size1 == size2.
      Parameters:
      size1 - First size.
      size2 - Second size.
      Throws:
      IllegalArgumentException - if size1 != size2
    • checkOption

      static <E extends Enum<E>> E checkOption(E v, Set<E> allowed)
      Check the option is allowed.
      Type Parameters:
      E - Option type.
      Parameters:
      v - Option value.
      allowed - Allowed options.
      Returns:
      the value
      Throws:
      IllegalArgumentException - if the value is not in the allowed options or is null
    • checkTable

      static void checkTable(int[][] table)
      Check the input is a 2-by-2 contingency table.
      Parameters:
      table - Table.
      Throws:
      IllegalArgumentException - if the table is not a 2-by-2 table; any table entry is negative; or the sum is zero or is not an integer