SalesPoint Framework v3.1

data
Class StockFromStockCreator

java.lang.Object
  extended bydata.StockFromStockCreator
All Implemented Interfaces:
StockFromValueCreator
Direct Known Subclasses:
StockFromStockCreatorBT

public class StockFromStockCreator
extends Object
implements StockFromValueCreator

StockFromValueCreator that tries to fill a Stock using only items from another Stock.

Since:
v0.5
Author:
Steffen Zschaler

Field Summary
protected  CatalogItemValue m_civEvaluator
          The CatalogItemValue used to determine the CatalogItems' values.
protected  Stock m_stSource
          The source Stock.
 
Constructor Summary
StockFromStockCreator(Stock stSource, CatalogItemValue civ)
          Create a new StockFromStockCreator.
 
Method Summary
 Value fillStock(Stock st, Value v, DataBasket db)
          Try to fill the given Stock using only items from the source Stock.
 
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.


m_stSource

protected Stock m_stSource
The source Stock.

Constructor Detail

StockFromStockCreator

public StockFromStockCreator(Stock stSource,
                             CatalogItemValue civ)
Create a new StockFromStockCreator.

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

fillStock

public Value fillStock(Stock st,
                       Value v,
                       DataBasket db)
Try to fill the given Stock using only items from the source Stock.

As this algorithm does not use backtracking, it may not always find a solution even if one would be possible.

Attention: The items that are added to the destination Stock will be removed from the source Stock.

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

SalesPoint Framework v3.1