Class Coordinates


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

      Constructors 
      Modifier Constructor Description
      private Coordinates()
      No public construction.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static double[] requireFinite​(double[] values, java.lang.String message)
      Check that the values are finite.
      (package private) static double[] requireLength​(double[] values, int length, java.lang.String message)
      Check that the values is the specified length.
      • Methods inherited from class java.lang.Object

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

      • Coordinates

        private Coordinates()
        No public construction.
    • Method Detail

      • requireFinite

        static double[] requireFinite​(double[] values,
                                      java.lang.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:
        java.lang.IllegalArgumentException - if a non-finite value is found
      • requireLength

        static double[] requireLength​(double[] values,
                                      int length,
                                      java.lang.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:
        java.lang.IllegalArgumentException - if the array length is not the specified length