SalesPoint Framework v3.1

data
Class DefaultCountingStockFromValueCreator

java.lang.Object
  extended bydata.DefaultCountingStockFromValueCreator
All Implemented Interfaces:
StockFromValueCreator

public class DefaultCountingStockFromValueCreator
extends Object
implements StockFromValueCreator

A StockFromValueCreator for CountingStocks.

This StockFromValueCreator assumes a potentially infinite source of available items and adds exactly as many items of each type (i.e. corresponding CatalogItem) as needed to fulfil the requirement.

Since:
v2.0
Author:
Steffen Zschaler

Field Summary
protected  CatalogItemValue m_civEvaluator
          The CatalogItemValue used to determine the CatalogItems' values.
 
Constructor Summary
DefaultCountingStockFromValueCreator(CatalogItemValue civ)
          Create a new DefaultCountingStockFromValueCreator.
 
Method Summary
 Value fillStock(Stock st, Value v, DataBasket db)
          This StockFromValueCreator assumes a potentially infinite source of available items and adds exactly as many items of each type (i.e.
static Comparator invertedCIValueOrder(CatalogItemValue civ)
          Helper method that creates a Comparator that orders CatalogItems, highest value first.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_civEvaluator

protected CatalogItemValue m_civEvaluator
The CatalogItemValue used to determine the CatalogItems' values.

Constructor Detail

DefaultCountingStockFromValueCreator

public DefaultCountingStockFromValueCreator(CatalogItemValue civ)
Create a new DefaultCountingStockFromValueCreator.

Parameters:
civ - the CatalogItemValue used to determine the CatalogItems' values.
Method Detail

fillStock

public Value fillStock(Stock st,
                       Value v,
                       DataBasket db)
This StockFromValueCreator assumes a potentially infinite source of available items and adds exactly as many items of each type (i.e. corresponding CatalogItem) as needed to fulfil the requirement.

Specified by:
fillStock in interface StockFromValueCreator
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:
Never

invertedCIValueOrder

public static final Comparator invertedCIValueOrder(CatalogItemValue civ)
Helper method that creates a Comparator that orders CatalogItems, highest value first.


SalesPoint Framework v3.1