View Javadoc

1   /*
2    * @(#)StockInterface.java Mar 3, 2004
3    * 
4    * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
5    * Delft, the Netherlands. All rights reserved.
6    * 
7    * See for project information <a href="http://www.simulation.tudelft.nl/">
8    * www.simulation.tudelft.nl </a>.
9    * 
10   * The source code and binary code of this software is proprietary information
11   * of Delft University of Technology.
12   */
13  
14  package nl.tudelft.simulation.supplychain.stock;
15  
16  import java.io.Serializable;
17  import java.util.Iterator;
18  
19  import nl.tudelft.simulation.event.EventProducerInterface;
20  import nl.tudelft.simulation.event.EventType;
21  import nl.tudelft.simulation.supplychain.actor.Trader;
22  import nl.tudelft.simulation.supplychain.product.Cargo;
23  import nl.tudelft.simulation.supplychain.product.Product;
24  
25  /***
26   * The StockInterface describes the standard services that any object
27   * representing Stock in the supply chain project should have. Methods are
28   * related to handling physical stock itself, and three types of information on
29   * the stock: the available amount (really in the warehouse), the ordered amount
30   * (how many units did we order), and the claimed amount (how many units are
31   * claimed for committed orders, as far as we know). <br>
32   * <br>
33   * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
34   * Delft, the Netherlands. All rights reserved.
35   * 
36   * See for project information <a href="http://www.simulation.tudelft.nl/">
37   * www.simulation.tudelft.nl </a>.
38   * 
39   * The source code and binary code of this software is proprietary information
40   * of Delft University of Technology.
41   * 
42   * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
43   *         Jacobs </a>, <a
44   *         href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
45   *         Verbraeck </a>
46   * @version $$Revision: 1.2 $$ $$Date: 2005/04/08 11:50:54 $$
47   */
48  public interface StockInterface extends Serializable, EventProducerInterface
49  {
50  	/*** An event to indicate stock levels changed */
51  	EventType STOCK_CHANGE_EVENT = new EventType("STOCK_CHANGE_EVENT");
52  
53  	/***
54  	 * @return the trader who owns this stock
55  	 */
56  	Trader getOwner();
57  
58  	/***
59  	 * Method addStock.
60  	 * 
61  	 * @param product the product
62  	 * @param amount the amount
63  	 * @param totalPrice the value of this amount of product
64  	 */
65  	void addStock(Product product, double amount, double totalPrice);
66  
67  	/***
68  	 * Method addStock.
69  	 * 
70  	 * @param cargo the cargo to add to the stock
71  	 */
72  	void addStock(Cargo cargo);
73  
74  	/***
75  	 * Method getStock.
76  	 * 
77  	 * @param product the product
78  	 * @param amount the amount
79  	 * @return Cargo a Cargo object with the product
80  	 */
81  	Cargo getStock(Product product, double amount);
82  
83  	/***
84  	 * Method getActualAmount.
85  	 * 
86  	 * @param product the product
87  	 * @return double the actual amount
88  	 */
89  	double getActualAmount(Product product);
90  
91  	/***
92  	 * Method getClaimedAmount.
93  	 * 
94  	 * @param product the product
95  	 * @return double the claimed amount
96  	 */
97  	double getClaimedAmount(Product product);
98  
99  	/***
100 	 * Method getOrderedAmount.
101 	 * 
102 	 * @param product the product
103 	 * @return double the ordered amount
104 	 */
105 	double getOrderedAmount(Product product);
106 
107 	/***
108 	 * Method changeClaimedAmount.
109 	 * 
110 	 * @param product the product
111 	 * @param delta the delta (positive or negative)
112 	 * @return boolean success or not
113 	 */
114 	boolean changeClaimedAmount(Product product, double delta);
115 
116 	/***
117 	 * Method changeOrderedAmount.
118 	 * 
119 	 * @param product the product
120 	 * @param delta the delta (positive or negative)
121 	 * @return boolean success or not
122 	 */
123 	boolean changeOrderedAmount(Product product, double delta);
124 
125 	/***
126 	 * Method getUnitPrice.
127 	 * 
128 	 * @param product the product
129 	 * @return double the price per unit
130 	 */
131 	double getUnitPrice(Product product);
132 
133 	/***
134 	 * Method iterator.
135 	 * 
136 	 * @return the iterator
137 	 */
138 	Iterator iterator();
139 
140 	/***
141 	 * give the number of product types in stock.
142 	 * 
143 	 * @return int number of products
144 	 */
145 	int numberOfProducts();
146 
147 	/***
148 	 * fires an update event on the current status of the stock for the specific
149 	 * product
150 	 * 
151 	 * @param product the product to fire the update for
152 	 */
153 	void sendStockUpdateEvent(Product product);
154 }