New changelist
This commit is contained in:
@ -1,14 +1,15 @@
|
||||
__author__ = 'sidya'
|
||||
|
||||
from src.m.Place import Place, TypePlace, ListeTypePlace
|
||||
from src.m.Place import Place, ListeTypePlace
|
||||
|
||||
|
||||
class Parking:
|
||||
"""
|
||||
Definie un parking
|
||||
"""
|
||||
def __init__(self, nbNiv, typePlacesParNiv):
|
||||
#self.__nbPlacesParNiveau = placesParNiv
|
||||
def __init__(self, nbNiv, typePlacesParNiv,nom):
|
||||
self.__nom = nom
|
||||
self.__nbPlacesParNiveau = typePlacesParNiv.nbPlaceTotal
|
||||
self.__prix = 10
|
||||
self.__nbNiveaux = nbNiv
|
||||
self.__Places = {}
|
||||
@ -16,21 +17,21 @@ class Parking:
|
||||
l = []
|
||||
for t in typePlacesParNiv.liste:
|
||||
for i in range(0, t.nb):
|
||||
l.append(Place(i+1, n, t.longueur, t.hauteur))
|
||||
self.__Places[n+1] = l
|
||||
l.append(Place(i + 1, n, t.longueur, t.hauteur))
|
||||
self.__Places[n ] = l
|
||||
|
||||
def recherchePlace(self, voiture):
|
||||
trouve = False
|
||||
place = None
|
||||
for i in range(0, self.__nbNiveaux):
|
||||
if trouve :
|
||||
if place != None:
|
||||
break
|
||||
l = [p for p in self.__Places[i].estLibre]
|
||||
for p in l :
|
||||
if p.dimValide(voiture.hauteur, voiture.longueur) :
|
||||
for p in l:
|
||||
if p.dimValide(voiture.hauteur, voiture.longueur):
|
||||
pass
|
||||
trouve = True
|
||||
place = p
|
||||
break
|
||||
return trouve
|
||||
return place
|
||||
|
||||
def nbPlacesLibresNiveau(self, niveau):
|
||||
i = 0
|
||||
@ -39,6 +40,12 @@ class Parking:
|
||||
i += 1
|
||||
return i
|
||||
|
||||
def nbPlacesLibresParking(self):
|
||||
nbP = 0
|
||||
for i in range(0,self.__nbNiveaux) :
|
||||
nbP += self.nbPlacesLibresNiveau(i)
|
||||
return nbP
|
||||
|
||||
def addAbonnement(self, Abonnement):
|
||||
pass
|
||||
|
||||
|
Reference in New Issue
Block a user