java.lang.Object
com.github.stephengold.joltjni.std.Std

public final class Std extends Object
Java equivalents for (and access to) certain features of the std:: namespace.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final PrintStream
    standard error stream (to expedite translation of C++ code)
    static final PrintStream
    standard output stream (to expedite translation of C++ code)
    static final String
    line separator (to expedite translation of C++ code)
    static final float
    difference between 1 and the smallest float greater than 1
    static final float
    largest finite value of type float
    static final int
    largest value of type int
  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    exp(float value)
    Return the exponential of the specified single-precision value.
    static float
    fmod(float numerator, float denominator)
    Return the remainder when numerator is divided by denominator.
    static float
    hypot(float opposite, float adjacent)
    Return the hypotenuse of the specified right triangle.
    static float
    pow(float base, float exponent)
    Return the specified power of the specified single-precision base.
    static void
    shuffle(int[] indices, DefaultRandomEngine generator)
    Shuffle the specified array.
    static void
    Shuffle the specified Java list.
    static int
    size(Object[] array)
    Count the number of elements in the specified array.
    static float
    sqrt(float value)
    Return the square root of the specified single-precision value.
    static int
    strcmp(String lhs, String rhs)
    Compare the specified strings lexicographically.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • FLT_EPSILON

      public static final float FLT_EPSILON
      difference between 1 and the smallest float greater than 1
      See Also:
    • FLT_MAX

      public static final float FLT_MAX
      largest finite value of type float
      See Also:
    • INT_MAX

      public static final int INT_MAX
      largest value of type int
      See Also:
    • cerr

      public static final PrintStream cerr
      standard error stream (to expedite translation of C++ code)
    • cout

      public static final PrintStream cout
      standard output stream (to expedite translation of C++ code)
    • endl

      public static final String endl
      line separator (to expedite translation of C++ code)
  • Method Details

    • exp

      public static float exp(float value)
      Return the exponential of the specified single-precision value. There's evidence this is faster than Math.exp(double).
      Parameters:
      value - the input exponent
      Returns:
      the exponential
    • fmod

      public static float fmod(float numerator, float denominator)
      Return the remainder when numerator is divided by denominator.
      Parameters:
      numerator - the numerator
      denominator - the denominator
      Returns:
      the remainder (with the same sign as numerator)
    • hypot

      public static float hypot(float opposite, float adjacent)
      Return the hypotenuse of the specified right triangle.
      Parameters:
      opposite - the signed length of the opposite side
      adjacent - the signed length of the adjacent side
      Returns:
      the length of the hypotenuse (≥0)
    • pow

      public static float pow(float base, float exponent)
      Return the specified power of the specified single-precision base. There's evidence this is faster than Math.pow(double, double).
      Parameters:
      base - the base value
      exponent - the exponent value
      Returns:
      the power value
    • shuffle

      public static void shuffle(int[] indices, DefaultRandomEngine generator)
      Shuffle the specified array.
      Parameters:
      indices - the values to shuffle (not null, modified)
      generator - the sequence generator to use (not null, modified)
    • shuffle

      public static void shuffle(List<Object> list, DefaultRandomEngine generator)
      Shuffle the specified Java list.
      Parameters:
      list - the list to shuffle (not null, modified)
      generator - the sequence generator to use (not null, modified)
    • size

      public static int size(Object[] array)
      Count the number of elements in the specified array.
      Parameters:
      array - the array to measure (not null, unaffected)
      Returns:
      the number of elements (≥0)
    • sqrt

      public static float sqrt(float value)
      Return the square root of the specified single-precision value. There's evidence this is slower than Math.sqrt(double).
      Parameters:
      value - the input value
      Returns:
      the square root
    • strcmp

      public static int strcmp(String lhs, String rhs)
      Compare the specified strings lexicographically.
      Parameters:
      lhs - the first string to compare (not null)
      rhs - the 2nd string to compare (not null)
      Returns:
      a negative value if lhs precedes rhs in lexicographical order, or greater than zero if lhs follows rhs, or zero if they are equal