T
- The entry typepublic class ChanceTable<T> extends RandomObjectTable<T>
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.entries
Constructor and Description |
---|
ChanceTable()
Creates a new
ChanceTable with a default roll count of 1. |
ChanceTable(int rolls)
Creates a new
ChanceTable . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
List<T> |
get(Random rand)
Performs a number of rolls according to the number of rolls defined by
RandomObjectTable.getRolls() and returns items from the table for each roll. |
int |
hashCode() |
String |
toString() |
add, add, addAll, clear, contains, containsAll, containsAllObjects, containsObject, getEntries, getRolls, isEmpty, iterator, remove, removeAll, removeObject, retainAll, setRolls, setRolls, size, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
parallelStream, removeIf, spliterator, stream
public ChanceTable()
ChanceTable
with a default roll count of 1.public ChanceTable(int rolls)
ChanceTable
.rolls
- The number of rolls to performpublic List<T> get(Random rand)
RandomObjectTable
RandomObjectTable.getRolls()
and returns items from the table for each roll.get
in class RandomObjectTable<T>
rand
- The random object to usepublic boolean equals(Object o)
equals
in interface Collection<TableEntry<T>>
equals
in class Object
public int hashCode()
hashCode
in interface Collection<TableEntry<T>>
hashCode
in class Object