Class Global

java.lang.Object
com.xebisco.yield.Global

public final class Global extends Object
A static class containing various utility functions and constants.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A static class containing platform-specific implementations.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static String
    A static string representing the application save ID.
    static final String
    Constants representing different axis.
    static final String
    Constants representing different axis.
    static final Random
    A static instance of the Random class.
    static final long
    A constant representing the revision number.
    static final String
    Constants representing different axis.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    clamp(double value, double min, double max)
    If value is greater than max, return max, otherwise return the greatest of value and min.
    static float
    clamp(float value, float min, float max)
    If value is greater than max, return max, otherwise return the greatest of value and min.
    static int
    clamp(int value, int min, int max)
    If value is greater than max, return max, otherwise return the greatest of value and min.
    static long
    clamp(long value, long min, long max)
    If value is greater than max, return max, otherwise return the greatest of value and min.
    static String
    This function returns the default directory for application data.
    static Vector2D
    onSizeBoundary(Vector2D size, Vector2D boundary)
    The function resizes a given size to fit within a specified boundary while maintaining its aspect ratio.

    Methods inherited from class java.lang.Object

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

    • HORIZONTAL

      public static final String HORIZONTAL
      Constants representing different axis.
      See Also:
    • VERTICAL

      public static final String VERTICAL
      Constants representing different axis.
      See Also:
    • JUMP

      public static final String JUMP
      Constants representing different axis.
      See Also:
    • REV

      public static final long REV
      A constant representing the revision number.
      See Also:
    • RANDOM

      public static final Random RANDOM
      A static instance of the Random class.
    • APP_SAVE_ID

      public static String APP_SAVE_ID
      A static string representing the application save ID.
  • Constructor Details

    • Global

      public Global()
  • Method Details

    • clamp

      public static int clamp(int value, int min, int max)
      If value is greater than max, return max, otherwise return the greatest of value and min.
      Parameters:
      value - The value to clamp.
      min - The minimum value that the returned value can be.
      max - The maximum value that the returned value can be.
      Returns:
      The value of the variable value if it is less than the variable max, otherwise the value of the variable max.
    • clamp

      public static long clamp(long value, long min, long max)
      If value is greater than max, return max, otherwise return the greatest of value and min.
      Parameters:
      value - The value to clamp.
      min - The minimum value that the returned value can be.
      max - The maximum value that the returned value can be.
      Returns:
      The value of the variable value if it is less than the variable max, otherwise the value of the variable max.
    • clamp

      public static double clamp(double value, double min, double max)
      If value is greater than max, return max, otherwise return the greatest of value and min.
      Parameters:
      value - The value to clamp.
      min - The minimum value that the returned value can be.
      max - The maximum value that the returned value can be.
      Returns:
      The value of the variable value if it is less than the variable max, otherwise the value of the variable max.
    • clamp

      public static float clamp(float value, float min, float max)
      If value is greater than max, return max, otherwise return the greatest of value and min.
      Parameters:
      value - The value to clamp.
      min - The minimum value that the returned value can be.
      max - The maximum value that the returned value can be.
      Returns:
      The value of the variable value if it is less than the variable max, otherwise the value of the variable max.
    • onSizeBoundary

      public static Vector2D onSizeBoundary(Vector2D size, Vector2D boundary)
      The function resizes a given size to fit within a specified boundary while maintaining its aspect ratio.
      Parameters:
      size - The size of the object that needs to be resized to fit within the boundary.
      boundary - The boundary parameter is a Size2D object that represents the maximum size that the input size can be scaled to while maintaining its aspect ratio.
      Returns:
      A new Size2D object with the adjusted width and height values based on the given size and boundary.
    • defaultDirectory

      public static String defaultDirectory()
      This function returns the default directory for application data.
      Returns:
      The default directory for application data.