Class Coordinates

java.lang.Object
org.apache.commons.rng.sampling.shape.Coordinates

final class Coordinates extends Object
Utility class for common coordinate operations for shape samplers.
Since:
1.4
  • Constructor Details

    • Coordinates

      private Coordinates()
      No public construction.
  • Method Details

    • requireFinite

      static double[] requireFinite(double[] values, String message)
      Check that the values are finite. This method is primarily for parameter validation in methods and constructors, for example:
       public Line(double[] start, double[] end) {
           this.start = Coordinates.requireFinite(start, "start");
           this.end = Coordinates.requireFinite(end, "end");
       }
       
      Parameters:
      values - the values
      message - the message detail to prepend to the message in the event an exception is thrown
      Returns:
      the values
      Throws:
      IllegalArgumentException - if a non-finite value is found
    • requireLength

      static double[] requireLength(double[] values, int length, String message)
      Check that the values is the specified length. This method is primarily for parameter validation in methods and constructors, for example:
       public Square(double[] topLeft, double[] bottomRight) {
           this.topLeft = Coordinates.requireLength(topLeft, 2, "topLeft");
           this.bottomRight = Coordinates.requireLength(bottomRight, 2, "bottomRight");
       }
       
      Parameters:
      values - the values
      length - the length
      message - the message detail to prepend to the message in the event an exception is thrown
      Returns:
      the values
      Throws:
      IllegalArgumentException - if the array length is not the specified length