Skip to content

Commit bc70f57

Browse files
Documented the Order class with javadoc tags.
1 parent 6eb9f32 commit bc70f57

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

src/main/java/coreapi/Order.java

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
2-
*
2+
* @author Borja
3+
* @version 0.2
34
*/
45
package coreapi;
56

@@ -9,12 +10,61 @@
910

1011
public interface Order {
1112

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+
*/
1218
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+
*/
1326
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+
*/
1432
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+
*/
1539
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+
*/
1647
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+
*/
1754
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+
*/
1861
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+
*/
1969
public boolean containsProduct(int id);
2070
}
File renamed without changes.

0 commit comments

Comments
 (0)