Class ErddapMath2

java.lang.Object
ucar.nc2.ogc.erddap.util.ErddapMath2

public class ErddapMath2 extends Object
The Math2 class has several static Math-related methods.
  • These are low level routines used by most other CoHort classes.
  • Many provide additional protection from run-time errors.
  • Field Details

    • memoryTooMuchData

      public static String memoryTooMuchData
      These are *not* final so EDStatic can replace them with translated Strings. These are MessageFormat-style strings, so any single quote ' must be escaped as ''.
    • memoryArraySize

      public static String memoryArraySize
  • Constructor Details

    • ErddapMath2

      public ErddapMath2()
  • Method Details

    • isFinite

      public static boolean isFinite(double d)
      Checks if the value is not NaN or +-Infinite. This works for floats.
      Parameters:
      d - any double value or float value
      Returns:
      true if d is is not NaN or +/-infinity.
    • ensureArraySizeOkay

      public static void ensureArraySizeOkay(long tSize, String attributeTo)
      Even if JavaBits is 64, the limit on an array size is Integer.MAX_VALUE.

      This is almost identical to EDStatic.ensureArraySizeOkay, but lacks tallying.

      Parameters:
      tSize -
      attributeTo - for a WARNING or ERROR message, this is the string to which this not-enough-memory issue should be attributed.
    • roundToInt

      public static int roundToInt(double d)
      Safely rounds a double to an int. (Math.round but rounds to a long and not safely.)
      Parameters:
      d - any double
      Returns:
      Integer.MAX_VALUE if d is too small, too big, or NaN; otherwise d, rounded to the nearest int. Undesirable: d.5 rounds up for positive numbers, down for negative.