-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOrder.java
More file actions
190 lines (160 loc) · 4.72 KB
/
Copy pathOrder.java
File metadata and controls
190 lines (160 loc) · 4.72 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
public class Order {
// Queue<Integer> qoid = new LinkedList<>();
// Queue<Integer> qmember_id = new LinkedList<>();
// Queue<Integer> qpId = new LinkedList<>();
// Queue<String> qbought_date = new LinkedList<>();
// Queue<Integer> qtotal = new LinkedList<>();
// Queue<String> qorder_status = new LinkedList<>();
static int[] oid = new int[100];
static int[] member_id = new int[100];
static int[] pId = new int[100];
static String[] bought_date = new String[100];
static int[] total = new int[100];
static String[] order_status = new String[100];
static int limit = 1;
static int leng = 0;
Order(int id_member, int idP, String date_bought, int totalP, String status_order) {
Order.oid[limit] = limit;
Order.member_id[limit] = id_member;
Order.pId[limit] = idP;
Order.bought_date[limit] = date_bought;
Order.total[limit] = totalP;
Order.order_status[limit] = status_order;
}
public int[] getMemberIdA(int id, int len) {
int[] idMember = new int[100];
leng = len;
for (int i = 0; i <= limit; i++) {
if (member_id[i] == id) {
idMember[leng] = i;
leng++;
}
}
return idMember;
}
public int getLeng() {
return leng;
}
// // -------------------------------------------
// public int[] getOidA(int id) {
// int[] idO = new int[100];
// int len = 0;
// for (int i = 0; i <= limit; i++) {
// if (member_id[i] == id) {
// idO[len] = oid[i];
// len++;
// }
// }
// return idO;
// }
// // public int getMemberIdA(int id) {
// // int idMember = 0;
// // for (int i = 0; i <= limit; i++) {
// // if (member_id[i] == id) {
// // idMember = member_id[i];
// // }
// // }
// // return idMember;
// // }
// public int[] getPidA(int id) {
// int[] idP = new int[100];
// int len = 0;
// for (int i = 0; i <= limit; i++) {
// if (member_id[i] == id) {
// idP[len] = pId[i];
// len++;
// }
// }
// return idP;
// }
// public String[] getBought_dateA(int id) {
// String[] date_bought = new String[100];
// int len = 0;
// for (int i = 0; i <= limit; i++) {
// if (member_id[i] == id) {
// date_bought[len] = bought_date[i];
// len++;
// }
// }
// return date_bought;
// }
// public int[] getTotalA(int id) {
// int[] totalO = new int[100];
// int len = 0;
// for (int i = 0; i <= limit; i++) {
// if (member_id[i] == id) {
// totalO[len] = total[i];
// len++;
// }
// }
// return totalO;
// }
// public String[] getOrder_StatusA(int id) {
// String[] status_order = new String[100];
// int len = 0;
// for (int i = 0; i <= limit; i++) {
// if (member_id[i] == id) {
// status_order[len] = order_status[i];
// len++;
// }
// }
// return status_order;
// }
// -----------------getNonArray--------------------
public static int getOid(int id) {
return oid[id];
}
public int getMemberId(int id) {
return member_id[id];
}
public static int getPid(int id) {
return pId[id];
}
public static String getBought_date(int id) {
return bought_date[id];
}
public static int getTotal(int id) {
return total[id];
}
public static String getOrder_Status(int id) {
return order_status[id];
}
// --------------------------------------setMothod---------------------------------------------------
public void makeAnOrder(int limP, int id_member, int idP, String date_bought, int totalP,
String status_order) {
// Sort Array
// Arrays.sort(oid);
// Arrays.sort(member_id);
// Arrays.sort(pId);
// Arrays.sort(bought_date);
// Arrays.sort(total);
// Arrays.sort(order_status);
// Add Parameter
limit += limP;
oid[limit] = limit;
member_id[limit] = id_member;
pId[limit] = idP;
bought_date[limit] = date_bought;
total[limit] = totalP;
order_status[limit] = status_order;
}
public void confirmOrder(int id) {
order_status[id] = "confirm";
}
public void deliveryOrder(int id, String status) {
order_status[id] = status;
}
public void completedOrder(int id, String status) {
order_status[id] = status;
}
public int cancelOrder(int id) {
int refund = total[id];
oid[id] = limit;
member_id[id] = 0;
pId[id] = 0;
bought_date[id] = null;
total[id] = 0;
order_status[id] = "Canceled";
return refund;
}
}