Class Platform

java.lang.Object
com.google.common.geometry.Platform

@GwtCompatible(emulated=true) final class Platform extends Object
Contains utility methods which require different GWT client and server implementations. This contains the server side implementations.
  • Constructor Details

    • Platform

      private Platform()
  • Method Details

    • IEEEremainder

      static double IEEEremainder(double f1, double f2)
      See Also:
    • getExponent

      static int getExponent(double d)
      See Also:
    • getLoggerForClass

      static Logger getLoggerForClass(Class<?> clazz)
      Returns the Logger for the class.
      See Also:
    • printf

      static void printf(PrintStream stream, String format, Object... params)
      Invokes stream.printf with the arguments. The GWT client just prints the format string and the arguments separately. Using this method is not recommended; you should instead construct strings with normal string concatenation whenever possible, so it will work the same way in normal Java and GWT client versions.
    • formatString

      static String formatString(String format, Object... params)
      Returns String.format with the arguments. The GWT client just returns a string consisting of the format string with the parameters concatenated to the end of it. Using this method is not recommended; you should instead construct strings with normal string concatenation whenever possible, so it will work the same way in normal Java and GWT client versions.
    • formatDouble

      static String formatDouble(double d)
      Formats the double as a string and removes unneeded trailing zeros, to behave the same as printf("%.15g",d) in C++. The Javascript implementation does NOT have identical behavior.
    • doubleHash

      public static long doubleHash(double value)
      A portable way to hash a double value.
    • sign

      public static int sign(S2Point a, S2Point b, S2Point c)
      Returns the sign of the determinant of the matrix constructed from the three column vectors a, b, and c. This operation is very robust for small determinants, but is extremely slow and should only be used if performance is not a concern or all faster techniques have been exhausted.
    • ulp

      public static double ulp(double x)
      Returns the size of an ulp of the argument. An ulp of a double value is the positive distance between this floating-point value and the double next larger in magnitude.
    • nextAfter

      public static double nextAfter(double x, double dir)
      Returns the next representable value in the direction of 'dir' starting from 'x', emulating the behavior of Math.nextAfter(double, double).
    • newBigDecimal

      static BigDecimal newBigDecimal(double x)
      Returns a new BigDecimal instance whose value is the exact decimal representation of x, emulating the behavior of BigDecimal(double).