Class RandomWeightedSet<A>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<A,Double>
com.pixelmonmod.pixelmon.api.util.RandomWeightedSet<A>
- Type Parameters:
A
- The type
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<A,
Double>
A set of items that have weighted and can be randomly selected from according to said weightings
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
static <B> com.mojang.serialization.Codec<RandomWeightedSet<B>>
codec
(com.mojang.serialization.Codec<B> codec) double
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Field Details
-
treeMap
-
totalWeight
protected transient double totalWeight
-
-
Constructor Details
-
RandomWeightedSet
public RandomWeightedSet() -
RandomWeightedSet
-
-
Method Details
-
add
-
clear
public void clear() -
getRandom
-
getTotalWeight
public double getTotalWeight() -
codec
public static <B> com.mojang.serialization.Codec<RandomWeightedSet<B>> codec(com.mojang.serialization.Codec<B> codec)
-