Class BoundedItemRandomizerModel<T>

  • Type Parameters:
    T - the type of item this random item model returns
    All Implemented Interfaces:
    ItemRandomizer<T>

    public final class BoundedItemRandomizerModel<T>
    extends ItemRandomizerModel<T>
    A ItemRandomizer with the added constraint that the total item weights can not exceed a defined maximum. When the weight of one item is incremented the weight of another is decremented in a round-robin kind of fashion and when an item weight is decremented the weight of another is incremented.
    User: Björn Darri
    Date: 6.4.2010
    Time: 21:26:00
    • Constructor Detail

      • BoundedItemRandomizerModel

        public BoundedItemRandomizerModel​(Collection<T> items)
        Instantiates a new BoundedRandomItemModel with a default bounded weight of 100.
        Parameters:
        items - the items
      • BoundedItemRandomizerModel

        public BoundedItemRandomizerModel​(int boundedWeight,
                                          Collection<T> items)
        Instantiates a new BoundedRandomItemModel with the given bounded weight.
        Parameters:
        boundedWeight - the maximum total weight
        items - the items