Interface ItemRandomizer.RandomItem<T>
- Type Parameters:
T
- the type being wrapped
- Enclosing interface:
- ItemRandomizer<T>
public static interface ItemRandomizer.RandomItem<T>
Wraps an item for usage in the ItemRandomizer.
For instances use the
randomItem(Object, int)
factory method.-
Method Summary
Modifier and TypeMethodDescriptionvoid
Decrements the weight value assigned to this random itemvoid
Increments the weight value assigned to this random itemboolean
item()
static <T> ItemRandomizer.RandomItem<T>
randomItem
(T item, int weight) Instantiates a newItemRandomizer.RandomItem
instance.void
setEnabled
(boolean enabled) void
setWeight
(int weight) int
weight()
-
Method Details
-
incrementWeight
void incrementWeight()Increments the weight value assigned to this random item -
decrementWeight
void decrementWeight()Decrements the weight value assigned to this random item -
setWeight
void setWeight(int weight) - Parameters:
weight
- the random weight assigned to this item
-
weight
int weight()- Returns:
- the random weight assigned to this item
-
isEnabled
boolean isEnabled()- Returns:
- true if this item is enabled
-
setEnabled
void setEnabled(boolean enabled) - Parameters:
enabled
- true if this item should be enabled
-
item
T item()- Returns:
- the item this random item represents
-
randomItem
Instantiates a newItemRandomizer.RandomItem
instance.- Type Parameters:
T
- the item type- Parameters:
item
- the itemweight
- the random selection weight to assign to this item- Returns:
- a new
ItemRandomizer.RandomItem
instance.
-