-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlistaCargueros.py
More file actions
67 lines (57 loc) · 1.69 KB
/
listaCargueros.py
File metadata and controls
67 lines (57 loc) · 1.69 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
from estados import Estados as sts
##Clase Lista de Remolcadores
class ListaCargueros:
def __init__(self,num):
self.list=[]
for i in range(num):
carguero=[i+1,0,0,-1]
self.list.append( carguero)
def getById(self,id):
res = []
for barco in self.list:
if barco[0]==id:
res = barco
break
return res
def modificar(self,iD,time,estado,petrolero):
carguero = self.getById(iD)
num = self.getPosId(iD)
carguero[1] = time
carguero[2] = estado
carguero[3] = petrolero
self.list[num]=carguero
def getPosId(self,iD):
res=0
for carguero in self.list:
if carguero[0] == iD:
break
res = res+1
return res
def libreEntrada(self):
res=False
for carguero in self.list:
if carguero[2]==sts.CARGUERO_COLA_ENTRADA:
res=True
break
return res
def libreSalida(self):
res=False
for carguero in self.list:
if carguero[2]==sts.CARGUERO_COLA_MUELLE:
res=True
break
return res
def getLibreEntrada(self):
res = []
for carguero in self.list:
if carguero[2]==sts.CARGUERO_COLA_ENTRADA:
res = carguero
break
return res
def getLibreSalida(self):
res = []
for carguero in self.list:
if carguero[2]==sts.CARGUERO_COLA_MUELLE:
res = carguero
break
return res