Package org.spongepowered.api.data.value
Interface WeightedCollectionValue<E>
- All Superinterfaces:
- CollectionValue<TableEntry<E>,,- WeightedTable<E>> - Iterable<TableEntry<E>>,- Value<WeightedTable<E>>
- All Known Subinterfaces:
- WeightedCollectionValue.Immutable<E>,- WeightedCollectionValue.Mutable<E>
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a particular type ofCollectionValue.Immutablethat is backed by aWeightedTable.static interfaceRepresents a particular type ofCollectionValue.Mutablethat is backed by aWeightedTable.Nested classes/interfaces inherited from interface org.spongepowered.api.data.value.ValueValue.Factory
- 
Method SummaryModifier and TypeMethodDescriptionRetrieves an immutable form of this value.Retrieves a mutable form of this value.Retrieves a copy in the mutable form of this value.Selects random valued from this list based on their weight.static <E> WeightedCollectionValue.Immutable<E>immutableOf(Supplier<? extends Key<? extends WeightedCollectionValue<E>>> key, WeightedTable<E> element) Constructs an immutableWeightedCollectionValueof the appropriate type based on the givenKeyand the element.static <E> WeightedCollectionValue.Immutable<E>immutableOf(Key<? extends WeightedCollectionValue<E>> key, WeightedTable<E> element) Constructs an immutableWeightedCollectionValueof the appropriate type based on the givenKeyand the element.Key<? extends WeightedCollectionValue<E>>key()Gets the key for thisValue.static <E> WeightedCollectionValue.Mutable<E>mutableOf(Supplier<? extends Key<? extends WeightedCollectionValue<E>>> key, WeightedTable<E> element) Constructs a mutableWeightedCollectionValueof the appropriate type based on the givenKeyand the element.static <E> WeightedCollectionValue.Mutable<E>mutableOf(Key<? extends WeightedCollectionValue<E>> key, WeightedTable<E> element) Constructs a mutableWeightedCollectionValueof the appropriate type based on the givenKeyand the element.Methods inherited from interface org.spongepowered.api.data.value.CollectionValueall, contains, containsAll, isEmpty, sizeMethods inherited from interface java.lang.IterableforEach, iterator, spliterator
- 
Method Details- 
mutableOfstatic <E> WeightedCollectionValue.Mutable<E> mutableOf(Key<? extends WeightedCollectionValue<E>> key, WeightedTable<E> element) Constructs a mutableWeightedCollectionValueof the appropriate type based on the givenKeyand the element.- Type Parameters:
- E- The element type
- Parameters:
- key- The key
- element- The element
- Returns:
- The constructed mutable value
 
- 
mutableOfstatic <E> WeightedCollectionValue.Mutable<E> mutableOf(Supplier<? extends Key<? extends WeightedCollectionValue<E>>> key, WeightedTable<E> element) Constructs a mutableWeightedCollectionValueof the appropriate type based on the givenKeyand the element.- Type Parameters:
- E- The element type
- Parameters:
- key- The key
- element- The element
- Returns:
- The constructed mutable value
 
- 
immutableOfstatic <E> WeightedCollectionValue.Immutable<E> immutableOf(Key<? extends WeightedCollectionValue<E>> key, WeightedTable<E> element) Constructs an immutableWeightedCollectionValueof the appropriate type based on the givenKeyand the element.- Type Parameters:
- E- The element type
- Parameters:
- key- The key
- element- The element
- Returns:
- The constructed immutable value
 
- 
immutableOfstatic <E> WeightedCollectionValue.Immutable<E> immutableOf(Supplier<? extends Key<? extends WeightedCollectionValue<E>>> key, WeightedTable<E> element) Constructs an immutableWeightedCollectionValueof the appropriate type based on the givenKeyand the element.- Type Parameters:
- E- The element type
- Parameters:
- key- The key
- element- The element
- Returns:
- The constructed immutable value
 
- 
keyKey<? extends WeightedCollectionValue<E>> key()Description copied from interface:ValueGets the key for thisValue.
- 
getSelects random valued from this list based on their weight.An empty list will be returned if there are no entries in the weighted table. - Parameters:
- random- The random object to use for selection
- Returns:
- The selected values
 
- 
asMutableWeightedCollectionValue.Mutable<E> asMutable()Description copied from interface:ValueRetrieves a mutable form of this value. Due to the vague nature of the value itself, some cases can already provide aValue.Mutableinstance where this would simply return itself. In other cases, where the retrieved value is anValue.Immutableinstance, a new mutable value is created with the same key and values.- Specified by:
- asMutablein interface- CollectionValue<TableEntry<E>,- WeightedTable<E>> 
- Specified by:
- asMutablein interface- Value<E>
- Returns:
- A mutable value
 
- 
asMutableCopyWeightedCollectionValue.Mutable<E> asMutableCopy()Description copied from interface:ValueRetrieves a copy in the mutable form of this value. The new is created with the same key and values.- Specified by:
- asMutableCopyin interface- CollectionValue<TableEntry<E>,- WeightedTable<E>> 
- Specified by:
- asMutableCopyin interface- Value<E>
- Returns:
- A mutable value
 
- 
asImmutableWeightedCollectionValue.Immutable<E> asImmutable()Description copied from interface:ValueRetrieves an immutable form of this value. Due to the vague nature of the value itself, some cases can already provide aValue.Immutableinstance where this would simply return itself. In other cases, where the retrieved value is aValue.Mutableinstance, a new immutable value is created with the same key and values.- Specified by:
- asImmutablein interface- CollectionValue<TableEntry<E>,- WeightedTable<E>> 
- Specified by:
- asImmutablein interface- Value<E>
- Returns:
- An immutable value
 
 
-