Class Platform


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

      Constructors 
      Modifier Constructor Description
      private Platform()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static long doubleHash​(double value)
      A portable way to hash a double value.
      (package private) static java.lang.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++.
      (package private) static java.lang.String formatString​(java.lang.String format, java.lang.Object... params)
      Returns String.format with the arguments.
      (package private) static int getExponent​(double d)  
      (package private) static java.util.logging.Logger getLoggerForClass​(java.lang.Class<?> clazz)
      Returns the Logger for the class.
      (package private) static double IEEEremainder​(double f1, double f2)  
      (package private) static java.math.BigDecimal newBigDecimal​(double x)
      Returns a new BigDecimal instance whose value is the exact decimal representation of x, emulating the behavior of BigDecimal(double).
      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).
      (package private) static void printf​(java.io.PrintStream stream, java.lang.String format, java.lang.Object... params)
      Invokes stream.printf with the arguments.
      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.
      static double ulp​(double x)
      Returns the size of an ulp of the argument.
      • Methods inherited from class java.lang.Object

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

      • Platform

        private Platform()
    • Method Detail

      • IEEEremainder

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

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

        static java.util.logging.Logger getLoggerForClass​(java.lang.Class<?> clazz)
        Returns the Logger for the class.
        See Also:
        Logger.getLogger(String)
      • printf

        static void printf​(java.io.PrintStream stream,
                           java.lang.String format,
                           java.lang.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 java.lang.String formatString​(java.lang.String format,
                                             java.lang.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 java.lang.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 java.math.BigDecimal newBigDecimal​(double x)
        Returns a new BigDecimal instance whose value is the exact decimal representation of x, emulating the behavior of BigDecimal(double).