Package de.Keyle.MyPet.api.gui
Record Class FloatRange
java.lang.Object
java.lang.Record
de.Keyle.MyPet.api.gui.FloatRange
- Record Components:
min- lower bound, inclusivemax- upper bound, inclusive; must not be belowmin
Inclusive `[min, max]` float range; samples uniformly. Used for pitch/volume randomization.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.floatmax()Returns the value of themaxrecord component.floatmin()Returns the value of theminrecord component.static FloatRangeof(float value) Creates a range that always yields the same value.floatDraws a value uniformly from this range.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
FloatRange
public FloatRange(float min, float max) Rejects a NaN bound or an inverted range.
-
-
Method Details
-
of
Creates a range that always yields the same value.- Parameters:
value- the fixed value- Returns:
- a range whose minimum and maximum are both
value
-
sample
Draws a value uniformly from this range.- Parameters:
r- the generator to draw from- Returns:
- a value in
[min, max], or the fixed value when the range is a point
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
min
public float min()Returns the value of theminrecord component.- Returns:
- the value of the
minrecord component
-
max
public float max()Returns the value of themaxrecord component.- Returns:
- the value of the
maxrecord component
-