T - Item typepublic class UnmodifiableWeightedTable<T> extends WeightedTable<T>
entries| Constructor and Description |
|---|
UnmodifiableWeightedTable(WeightedTable<T> table)
Creates a new
UnmodifiableWeightedTable with the provided
WeightedTable. |
UnmodifiableWeightedTable(WeightedTable<T> table,
int rolls)
|
UnmodifiableWeightedTable(WeightedTable<T> table,
VariableAmount rolls)
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(TableEntry<T> entry) |
boolean |
add(T object,
double weight)
Adds the given object to the table with the given weight.
|
boolean |
addAll(Collection<? extends TableEntry<T>> c) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
containsAllObjects(Collection<?> c)
Gets if this table contains all of the given objects, the objects may
either be
TableEntrys or the objects contained within the
entries. |
boolean |
containsObject(Object obj)
Gets if this table contains the given object, the object may either be a
TableEntry or the object contained within. |
boolean |
equals(Object o) |
void |
forEach(Consumer<? super TableEntry<T>> action) |
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. |
List<TableEntry<T>> |
getEntries()
Gets the entries in the table.
|
VariableAmount |
getRolls()
Gets the number of times this table will roll while retrieving items.
|
int |
hashCode() |
boolean |
isEmpty() |
Iterator<TableEntry<T>> |
iterator() |
Stream<TableEntry<T>> |
parallelStream() |
boolean |
remove(Object entry) |
boolean |
removeAll(Collection<?> c) |
boolean |
removeIf(Predicate<? super TableEntry<T>> filter) |
boolean |
removeObject(Object entry)
Removes the first instance of an entry in this table which is a
WeightedObject entry and contains the given object. |
boolean |
retainAll(Collection<?> c) |
void |
setRolls(int rolls)
Sets the number of times this table will roll while retrieving items.
|
void |
setRolls(VariableAmount rolls)
Sets the number of times this table will roll while retrieving items.
|
int |
size() |
Spliterator<TableEntry<T>> |
spliterator() |
Stream<TableEntry<T>> |
stream() |
Object[] |
toArray() |
<R> R[] |
toArray(R[] a) |
String |
toString() |
recalculateWeightpublic UnmodifiableWeightedTable(WeightedTable<T> table)
UnmodifiableWeightedTable with the provided
WeightedTable.table - The table to providepublic UnmodifiableWeightedTable(WeightedTable<T> table, int rolls)
table - The tablerolls - The rollspublic UnmodifiableWeightedTable(WeightedTable<T> table, VariableAmount rolls)
table - The tablerolls - The rollspublic boolean add(TableEntry<T> entry)
add in interface Collection<TableEntry<T>>add in class WeightedTable<T>public boolean add(T object, double weight)
RandomObjectTableadd in class WeightedTable<T>object - The new objectweight - The weight of the objectpublic boolean addAll(Collection<? extends TableEntry<T>> c)
addAll in interface Collection<TableEntry<T>>addAll in class WeightedTable<T>public void setRolls(VariableAmount rolls)
RandomObjectTablesetRolls in class RandomObjectTable<T>rolls - The new roll countpublic void setRolls(int rolls)
RandomObjectTablesetRolls in class RandomObjectTable<T>rolls - The new roll countpublic boolean remove(Object entry)
remove in interface Collection<TableEntry<T>>remove in class WeightedTable<T>public boolean removeObject(Object entry)
RandomObjectTableWeightedObject entry and contains the given object.removeObject in class WeightedTable<T>entry - The object to removepublic boolean removeAll(Collection<?> c)
removeAll in interface Collection<TableEntry<T>>removeAll in class WeightedTable<T>public boolean removeIf(Predicate<? super TableEntry<T>> filter)
public boolean retainAll(Collection<?> c)
retainAll in interface Collection<TableEntry<T>>retainAll in class WeightedTable<T>public void clear()
clear in interface Collection<TableEntry<T>>clear in class WeightedTable<T>public Iterator<TableEntry<T>> iterator()
iterator in interface Iterable<TableEntry<T>>iterator in interface Collection<TableEntry<T>>iterator in class WeightedTable<T>public boolean contains(Object o)
contains in interface Collection<TableEntry<T>>contains in class RandomObjectTable<T>public VariableAmount getRolls()
RandomObjectTablegetRolls in class RandomObjectTable<T>public List<T> get(Random rand)
RandomObjectTableRandomObjectTable.getRolls() and returns items from the table for each roll.get in class WeightedTable<T>rand - The random object to usepublic boolean containsObject(Object obj)
RandomObjectTableTableEntry or the object contained within.containsObject in class RandomObjectTable<T>obj - The object to check forpublic boolean containsAll(Collection<?> c)
containsAll in interface Collection<TableEntry<T>>containsAll in class RandomObjectTable<T>public boolean containsAllObjects(Collection<?> c)
RandomObjectTableTableEntrys or the objects contained within the
entries.containsAllObjects in class RandomObjectTable<T>c - The objects to check forpublic boolean isEmpty()
isEmpty in interface Collection<TableEntry<T>>isEmpty in class RandomObjectTable<T>public int size()
size in interface Collection<TableEntry<T>>size in class RandomObjectTable<T>public List<TableEntry<T>> getEntries()
RandomObjectTablegetEntries in class RandomObjectTable<T>public Object[] toArray()
toArray in interface Collection<TableEntry<T>>toArray in class RandomObjectTable<T>public <R> R[] toArray(R[] a)
toArray in interface Collection<TableEntry<T>>toArray in class RandomObjectTable<T>public Spliterator<TableEntry<T>> spliterator()
public Stream<TableEntry<T>> stream()
public Stream<TableEntry<T>> parallelStream()
public void forEach(Consumer<? super TableEntry<T>> action)
public String toString()
toString in class WeightedTable<T>public int hashCode()
hashCode in interface Collection<TableEntry<T>>hashCode in class WeightedTable<T>public boolean equals(Object o)
equals in interface Collection<TableEntry<T>>equals in class WeightedTable<T>