Package com.xebisco.yield
Class Global
java.lang.Object
com.xebisco.yield.Global
A static class containing various utility functions and constants.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA static class containing platform-specific implementations. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringA static string representing the application save ID.static final StringConstants representing different axis.static final StringConstants representing different axis.static final RandomA static instance of theRandomclass.static final longA constant representing the revision number.static final StringConstants representing different axis. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleclamp(double value, double min, double max) If value is greater than max, return max, otherwise return the greatest of value and min.static floatclamp(float value, float min, float max) If value is greater than max, return max, otherwise return the greatest of value and min.static intclamp(int value, int min, int max) If value is greater than max, return max, otherwise return the greatest of value and min.static longclamp(long value, long min, long max) If value is greater than max, return max, otherwise return the greatest of value and min.static StringThis function returns the default directory for application data.static Vector2DonSizeBoundary(Vector2D size, Vector2D boundary) The function resizes a given size to fit within a specified boundary while maintaining its aspect ratio.
-
Field Details
-
HORIZONTAL
Constants representing different axis.- See Also:
-
VERTICAL
Constants representing different axis.- See Also:
-
JUMP
Constants representing different axis.- See Also:
-
REV
public static final long REVA constant representing the revision number.- See Also:
-
RANDOM
A static instance of theRandomclass. -
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
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
This function returns the default directory for application data.- Returns:
- The default directory for application data.
-