Hook: Add A Value To A Stock's Contents
Requirement
        A certain value needs to be added to a Stock's total value.
        
          For example, consider a post office application where customers can,
          among other things, buy stamps. A common case would be that customers
          come to the desk and ask for 
"
stamps for $10
"
. As stamps
          come only in fixed denominations, like $0.20, $0.10, etc., the clerk
          has to assemble stamps of different denominations so as to fulfil the
          customer's demand.
        
      
Method of AdaptationEnable Feature 
Level of SupportParameter Pattern
 HotSpotData management
ParticipantsAlgorithm
, 
DefaultCountingStockFromValueCreator, 
StockFromStockCreator, 
StockFromStockCreatorBT, 
StockFromValueCreator, 
Stock, 
stock
, 
Value, 
value
, 
DataBasket, 
dataBasket
, 
algorithm
Changes
- 
          choose algorithm to be used for assembling denominations.
        
- 
          if one of the algorithms available in the Framework:
        
- 
            select Algorithm from (DefaultCountingStockFromValueCreator,
            StockFromStockCreator, StockFromStockCreatorBT).
          
- 
          else:
        
- 
            implementation Algorithm of StockFromValueCreator.
          
- 
            Algorithm.fillStock implements
            
              StockFromValueCreator.fillStock
            
.
          
- 
          instance stock of Stock.
        
- 
          instance value of Value.
        
- 
          instance dataBasket of DataBasket.
        
- 
          instance algorithm of Algorithm.
        
- 
          call
          
            stock.fillStockWithValue
          
 with parameters value, dataBasket and algorithm.