-
Notifications
You must be signed in to change notification settings - Fork 1
/
supplyChainQueue.py
46 lines (29 loc) · 1.05 KB
/
supplyChainQueue.py
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
# This file contains and defines the SupplyChainQueue class.
# The SupplyChainQueue consists of a two element list. Element
# 0 is the oldest order/delivery in the queue, and element 1
# is the second oldest order/delivery in the queue, etc. The
# queue length is limited by the queueLength parameter.
class SupplyChainQueue():
def __init__(self, queueLength):
self.queueLength = queueLength
self.data = []
return
def PushEnvelope(self, numberOfCasesToOrder):
orderSuccessfullyPlaced = False
if len(self.data) < self.queueLength:
self.data.append(numberOfCasesToOrder)
orderSuccessfullyPlaced = True
return orderSuccessfullyPlaced
def AdvanceQueue(self):
self.data.pop(0)
return
def PopEnvelope(self):
if len(self.data) >= 1:
quantityDelivered = self.data[0]
self.AdvanceQueue()
else:
quantityDelivered = 0
return quantityDelivered
def PrettyPrint(self):
print(self.data)
return