-
Notifications
You must be signed in to change notification settings - Fork 1
/
ParkingLot.py
47 lines (45 loc) · 1.42 KB
/
ParkingLot.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
47
__author__ = 'TriNguyenDang'
from Slot import *
from Location import *
from ManagerPrefer import *
class Parkinglot(object):
SlotList = None
Quota = None
Owned = None
def __init__(self,Data):
self.SlotList = []
self.SlotList = Data[0]
self.Owned = Data[1]
def __getitem__(self, item):
if(item == 'SlotList'):
return self.SlotList
elif(item == O):
return self.Owned
def __setitem__(self, key, value):
if(key == 'SlotList'):
self.SlotList = value
elif(key == O):
self.Owned = value
def __str__(self):
return "Des:\n %s\nList:\n %s"%(self.Owned,self.SlotList)
def __repr__(self):
return "<Des: %s, List: %s>"%(self.Owned,self.SlotList)
@staticmethod
def InitData(Type):
if(Type == 'A'):
Own = Location(XD,YD)
elif(Type == 'B'):
Own = Location(XD,-YD)
elif(Type == 'C'):
Own = Location(-XD,YD)
elif(Type == 'D'):
Own = Location(-XD,-YD)
else:
Own = Location.InitDestination()
Xaxis = Own[X]/XD
Yaxis = Own[Y]/YD
TmpS = []
for x in range(1,LOW_BOUND):
for y in range(1,SUP_BOUND):
TmpS.append(Slot([Location(x*Xaxis,y*Yaxis),random.uniform(CONST_SUP_FEE,CONST_INF_FEE),True,ManagerPrefer(),Location(0,0),0]))
return TmpS,Own