Module is.codion.common.model
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 TypeMethodDescriptionvoidDecrements the weight value assigned to this random itemvoidIncrements the weight value assigned to this random itembooleanitem()static <T> ItemRandomizer.RandomItem<T>randomItem(T item, int weight) Instantiates a newItemRandomizer.RandomIteminstance.voidsetEnabled(boolean enabled) voidsetWeight(int weight) intweight()
-
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.RandomIteminstance.- Type Parameters:
T- the item type- Parameters:
item- the itemweight- the random selection weight to assign to this item- Returns:
- a new
ItemRandomizer.RandomIteminstance.
-