Skip to content

Commit 9a67192

Browse files
OrderService Java Doc
1 parent f37d77f commit 9a67192

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

src/main/java/coreapi/OrderService.java

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ public OrderService() {}
1616
* PRECONDITION:Receive an order and an id of a existing product, plus a positive quantity
1717
* POSTCONDITION: Add the product with the indicated quantity to the order
1818
*/
19+
/**
20+
* Add a quantity of product to an order of a cafeteria.
21+
* @param coffe the Cafeteria which stock the different orders.
22+
* @param ord the order which stock the different products and the quantities.
23+
* @param productId the id of the product which will be add to the order.
24+
* @param q the quantity of the product.
25+
* @throws If the product is already in the basket
26+
* @throws If there isn't enough stock of the product
27+
*/
1928
public void addProductToOrder(Cafeteria coffe, OrderImpl ord, int productId, int q)
2029
{
2130
Product prod = ProductCatalog.Instance().getProduct(productId);
@@ -44,6 +53,15 @@ public void addProductToOrder(Cafeteria coffe, OrderImpl ord, int productId, int
4453
* PRECONDITION:Receive an order and an id of a existing product, plus a positive quantity
4554
* POSTCONDITION: Modify the quantity of the product indicated in the order
4655
*/
56+
/**
57+
* Modify the quantity of a product in an order
58+
* @param coffe the Cafeteria which stock the different orders.
59+
* @param ord the order which stock the different products and the quantities.
60+
* @param productId the id of the product which will be add to the order.
61+
* @param q the quantity of the product.
62+
* @throws If there isn't enough stock of the product
63+
* @throws If the product isn't in the basket
64+
*/
4765
public void modifyProductQuantity(Cafeteria coffe, OrderImpl ord, int productId, int q)
4866
{
4967
Product prod = ProductCatalog.Instance().getProduct(productId);
@@ -69,6 +87,13 @@ public void modifyProductQuantity(Cafeteria coffe, OrderImpl ord, int productId,
6987
* PRECONDITION:Receive an order and an id of a existing product, plus a positive quantity
7088
* POSTCONDITION:Eliminate the indicated amount of the product
7189
*/
90+
/**
91+
* @param ord the order which stock the different products and the quantities.
92+
* @param productId the id of the product which will be add to the order.
93+
* @param q the quantity of the product.
94+
* @throws If the quantity to remove is bigger than the quantity which is stock in the order
95+
* @throws If the product isn't in the basket
96+
*/
7297
public void removeProductFromOrder(OrderImpl ord, int productId, int q)
7398
{
7499
int quantbasket = ord.checkProductQuantity(productId);
@@ -95,6 +120,9 @@ public void removeProductFromOrder(OrderImpl ord, int productId, int q)
95120
* PRECONDITION:Receive an order
96121
* POSTCONDITION: Assign the status to the order
97122
*/
123+
/**
124+
*
125+
*/
98126
public void OrderStatus_InKitchen(OrderImpl ord)
99127
{
100128
//There must be products in the basket and the order be in the open state
@@ -112,6 +140,12 @@ public void OrderStatus_InKitchen(OrderImpl ord)
112140
* PRECONDITION:Receive an order
113141
* POSTCONDITION: Assign the status to the order
114142
*/
143+
/**
144+
* Returns the current counter of created Orders.
145+
* This is id number that will be assigned to the next Order created,
146+
* which is unique for each and everyone of them.
147+
* @return the current unique id counter.
148+
*/
115149
public void OrderStatus_Delivered(OrderImpl ord)
116150
{
117151
//The state must be in the kitchen to be delivered
@@ -128,6 +162,12 @@ public void OrderStatus_Delivered(OrderImpl ord)
128162
* PRECONDITION:Receive an order
129163
* POSTCONDITION: Assign the status to the order
130164
*/
165+
/**
166+
* Returns the current counter of created Orders.
167+
* This is id number that will be assigned to the next Order created,
168+
* which is unique for each and everyone of them.
169+
* @return the current unique id counter.
170+
*/
131171
public void OrderStatus_Payed(OrderImpl ord)
132172
{
133173
//The state must be delivered or in the kitchen in order to be paid
@@ -146,6 +186,12 @@ public void OrderStatus_Payed(OrderImpl ord)
146186
* PRECONDITION:Receive an order
147187
* POSTCONDITION: Assign the status to the order
148188
*/
189+
/**
190+
* Returns the current counter of created Orders.
191+
* This is id number that will be assigned to the next Order created,
192+
* which is unique for each and everyone of them.
193+
* @return the current unique id counter.
194+
*/
149195
public void OrderStatus_Finished(OrderImpl ord)
150196
{
151197
// The state must be charged in order to be finalized
@@ -166,6 +212,12 @@ public void OrderStatus_Finished(OrderImpl ord)
166212
* PRECONDITION: Receive a date
167213
* POSTCONDITION: Return the total of all orders for the date entered.
168214
*/
215+
/**
216+
* Returns the current counter of created Orders.
217+
* This is id number that will be assigned to the next Order created,
218+
* which is unique for each and everyone of them.
219+
* @return the current unique id counter.
220+
*/
169221
public BigDecimal getDailyRegister(Cafeteria coffe, Date date)
170222
{
171223
BigDecimal dailyRegister = BigDecimal.ZERO;

0 commit comments

Comments
 (0)