Class ChanceTable<T>
java.lang.Object
org.spongepowered.api.util.weighted.RandomObjectTable<T>
org.spongepowered.api.util.weighted.ChanceTable<T>
- Type Parameters:
- T- The entry type
- All Implemented Interfaces:
- Iterable<TableEntry<T>>,- Collection<TableEntry<T>>
This is a variant of the 
RandomObjectTable which uses a 0-1 chance
 attached to every entry. When rolled the a chance roll is calculated for each
 entry and all entries which pass are returned.- 
Field SummaryFields inherited from class org.spongepowered.api.util.weighted.RandomObjectTableentries
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a newChanceTablewith a default roll count of 1.ChanceTable(int rolls) Creates a newChanceTable.
- 
Method SummaryMethods inherited from class org.spongepowered.api.util.weighted.RandomObjectTableadd, add, addAll, clear, contains, containsAll, containsAllObjects, containsObject, entries, isEmpty, iterator, remove, removeAll, removeObject, retainAll, rolls, setRolls, setRolls, size, toArray, toArrayMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.CollectionparallelStream, removeIf, spliterator, stream, toArray
- 
Constructor Details- 
ChanceTablepublic ChanceTable()Creates a newChanceTablewith a default roll count of 1.
- 
ChanceTablepublic ChanceTable(int rolls) Creates a newChanceTable.- Parameters:
- rolls- The number of rolls to perform
 
 
- 
- 
Method Details- 
getDescription copied from class:RandomObjectTablePerforms a number of rolls according to the number of rolls defined byRandomObjectTable.rolls()and returns items from the table for each roll.- Specified by:
- getin class- RandomObjectTable<T>
- Parameters:
- rand- The random object to use
- Returns:
- The returned items, may be empty but not null
 
- 
equals- Specified by:
- equalsin interface- Collection<T>
- Overrides:
- equalsin class- Object
 
- 
hashCodepublic int hashCode()- Specified by:
- hashCodein interface- Collection<T>
- Overrides:
- hashCodein class- Object
 
- 
toString
 
-