SalesPoint Framework v3.1

data
Interface StockFromValueCreator

All Known Implementing Classes:
DefaultCountingStockFromValueCreator, StockFromStockCreator

public interface StockFromValueCreator

Strategy that increases a Stock's total value by adding StockItems that sum up to a given amount.

Since:
v0.5
Author:
Steffen Zschaler
See Also:
Stock.fillStockWithValue(data.DataBasket, data.Value, data.StockFromValueCreator)

Method Summary
 Value fillStock(Stock st, Value v, DataBasket db)
          The actual algorithm.
 

Method Detail

fillStock

public Value fillStock(Stock st,
                       Value v,
                       DataBasket db)
The actual algorithm.

The method should add StockItems to st so that the total value of all these items becomes the biggest value that is smaller or equal v. The difference between v and the actual total value of the added StockItems is to be returned.

To avoid dead-locks, this method must not trigger any threads!

Parameters:
st - the Stock to which to add the StockItems.
v - the value to be added to the Stock.
db - the DataBasket relative to which to perform the operation.
Override:
Always

SalesPoint Framework v3.1