Class Coordinates
java.lang.Object
org.apache.commons.rng.sampling.shape.Coordinates
Utility class for common coordinate operations for shape samplers.
- Since:
- 1.4
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static double[]
requireFinite
(double[] values, String message) Check that the values are finite.(package private) static double[]
requireLength
(double[] values, int length, String message) Check that the values is the specified length.
-
Constructor Details
-
Coordinates
private Coordinates()No public construction.
-
-
Method Details
-
requireFinite
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 valuesmessage
- 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
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 valueslength
- the lengthmessage
- 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
-