-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInventory.java
More file actions
67 lines (55 loc) · 1.64 KB
/
Inventory.java
File metadata and controls
67 lines (55 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* @authour: muteeba jamal <a href="mailto:muteeba.jamal@ucalgary.ca">
* muteeba.jamal@ucalgary.ca</a>
* @authour: shahzill naveed <a href="mailto:shahzill.naveed@ucalgary.ca">
* shahzill.naveed@ucalgary.ca</a>
* @authour: ahsan zia <a href="mailto:ahsan.zia@ucalgary.ca">
* ahsan.zia@ucalgary.ca</a>
* @authour: hridika banik <a href="mailto:hridika.banik@ucalgary.ca">
* hridika.banik@ucalgary.ca</a>
* @version 1.2
* @since 1.0
*/
package edu.ucalgary.ensf409;
import java.rmi.server.UnicastRemoteObject;
import java.util.LinkedList;
public class Inventory{
private static LinkedList<Food> foodList;
/*
* Inventory Constructor
*
* This copies the data of a Linked List to the foodList
*
* @param listOfFoods is the Linked list of foods.
*
*
*/
public Inventory(LinkedList<Food> listOfFoods){
this.foodList = listOfFoods;
}
/*
* removeFood
* removes the food from inventory and send an id to
* the deleteFood() method which deletes the food from
* the SQL inventory
*
* @param id is the id of the food that is to be removed
*/
public static void removeFood(int id){
for (int i = 0; i < foodList.size(); i++){
Food food = foodList.get(i);
if (food.getFoodID() == id ){
foodList.remove(i);
Project.deleteFood(Integer.toString(id));
}
}
}
/*
* getFoodList()
* returns the foodList object
*
*/
public static LinkedList<Food> getFoodList(){
return foodList;
}
}