Record Class WeightedRandomSelector.WeightedObject<T>
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.selector.type.WeightedRandomSelector.WeightedObject<T>
- Type Parameters:
T
- The type- Record Components:
weight
- The weightvalue
- The value
- Enclosing class:
- WeightedRandomSelector<T>
public static record WeightedRandomSelector.WeightedObject<T>(double weight, T value)
extends Record
Represents an instanceof the type with a weight
-
Constructor Summary
ConstructorDescriptionWeightedObject
(double weight, T value) Creates an instance of aWeightedObject
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic <A> com.mojang.serialization.Codec<WeightedRandomSelector.WeightedObject<A>>
codec
(com.mojang.serialization.Codec<A> codec) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.final String
toString()
Returns a string representation of this record class.value()
Returns the value of thevalue
record component.double
weight()
Returns the value of theweight
record component.
-
Constructor Details
-
Method Details
-
codec
public static <A> com.mojang.serialization.Codec<WeightedRandomSelector.WeightedObject<A>> codec(com.mojang.serialization.Codec<A> codec) -
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
weight
public double weight()Returns the value of theweight
record component.- Returns:
- the value of the
weight
record component
-
value
Returns the value of thevalue
record component.- Returns:
- the value of the
value
record component
-