|
1 | 1 | /** |
2 | | - * |
| 2 | + * @author Borja |
| 3 | + * @version 0.2 |
3 | 4 | */ |
4 | 5 | package coreapi; |
5 | 6 |
|
|
9 | 10 |
|
10 | 11 | public interface Order { |
11 | 12 |
|
| 13 | + /** |
| 14 | + * Returns the combined cost of the whole order. |
| 15 | + * Takes into account which products comprised the order, and how many of each of them. |
| 16 | + * @return the cost of the order. |
| 17 | + */ |
12 | 18 | public float totalCost(); |
| 19 | + /** |
| 20 | + * Returns the unique Id assigned to this order. |
| 21 | + * Each Order has a unique identifier within the system. Two different orders cannot |
| 22 | + * have the same id at any time. |
| 23 | + * @return the order Id. |
| 24 | + * @see OrderFactory |
| 25 | + */ |
13 | 26 | public int getId(); |
| 27 | + /** |
| 28 | + * Returns the timestamp representing the date when the order was created. |
| 29 | + * @return timestamp from the creation of the order |
| 30 | + * @see Date |
| 31 | + */ |
14 | 32 | public Date getDate(); |
| 33 | + /** |
| 34 | + * Returns the constant corresponding to the current state of the order, |
| 35 | + * as determined by the Enum <code>OrderStatus</code>. |
| 36 | + * @return the current state of the order. |
| 37 | + * @see OrderStatus |
| 38 | + */ |
15 | 39 | public OrderStatus getStatus(); |
| 40 | + /** |
| 41 | + * Returns a read-only list of the products contained in this order. |
| 42 | + * The list does NOT contain how many of each product is contained within the order. |
| 43 | + * @return the list of products in this order. |
| 44 | + * @see List |
| 45 | + * @see Product |
| 46 | + */ |
16 | 47 | public List<Product> getProducts(); |
| 48 | + /** |
| 49 | + * Returns a map containing the products contained in this order, |
| 50 | + * and how many of each of them is stored. |
| 51 | + * @return the map containing the quantity of each product in the order |
| 52 | + * @see Map |
| 53 | + */ |
17 | 54 | public Map<Product, Integer> getBasket(); |
| 55 | + /** |
| 56 | + * Returns how much of a certain product is contained within this order. |
| 57 | + * If the product isn't contained in this order, the return value is zero. |
| 58 | + * @param id The id of the product to check. |
| 59 | + * @return the amount of a certain product in this order. |
| 60 | + */ |
18 | 61 | public int checkProductQuantity(int id); |
| 62 | + /** |
| 63 | + * Returns whether or not the product passed as parameter is contained in this order or not. |
| 64 | + * The return value is <code>true</code> if there is at least 1 unit of the product in this order, |
| 65 | + * and <code>false</code> if there is none. |
| 66 | + * @param id The id of the product to check. |
| 67 | + * @return true if the order contains the specified product. |
| 68 | + */ |
19 | 69 | public boolean containsProduct(int id); |
20 | 70 | } |
0 commit comments