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 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

      static <T> ItemRandomizer.RandomItem<T> randomItem(T item, int weight)
      Instantiates a new ItemRandomizer.RandomItem instance.
      Type Parameters:
      T - the item type
      Parameters:
      item - the item
      weight - the random selection weight to assign to this item
      Returns:
      a new ItemRandomizer.RandomItem instance.