|
3 | 3 |
|
4 | 4 | class Contrato: |
5 | 5 | def __init__(self, data, cliente, tipo): |
6 | | - self.__data = data |
7 | | - self.__cliente = cliente |
8 | | - self.__tipo = tipo |
9 | | - |
10 | | - @property |
11 | | - def data(self): |
12 | | - return self.__data |
13 | | - |
14 | | - @data.setter |
15 | | - def data(self, data): |
16 | | - self.__data = data |
17 | | - |
18 | | - @property |
19 | | - def cliente(self): |
20 | | - return self.__cliente |
21 | | - |
22 | | - @cliente.setter |
23 | | - def cliente(self, cliente): |
24 | | - self.__cliente = cliente |
25 | | - |
26 | | - @property |
27 | | - def tipo(self): |
28 | | - return self.__tipo |
29 | | - |
30 | | - @tipo.setter |
31 | | - def tipo(self, tipo): |
32 | | - self.__tipo = tipo |
| 6 | + self.data = data |
| 7 | + self.cliente = cliente |
| 8 | + self.tipo = tipo |
33 | 9 |
|
34 | 10 | def avanca(self): |
35 | | - if self.__tipo == "NOVO": |
36 | | - self.__tipo = "EM ANDAMENTO" |
37 | | - elif self.__tipo == "EM ANDAMENTO": |
38 | | - self.__tipo = "ACERTADO" |
39 | | - elif self.__tipo == "ACERTADO": |
40 | | - self.__tipo = "CONCLUIDO" |
| 11 | + if self.tipo == "NOVO": |
| 12 | + self.tipo = "EM ANDAMENTO" |
| 13 | + elif self.tipo == "EM ANDAMENTO": |
| 14 | + self.tipo = "ACERTADO" |
| 15 | + elif self.tipo == "ACERTADO": |
| 16 | + self.tipo = "CONCLUIDO" |
41 | 17 |
|
42 | 18 | def salva_estado(self): |
43 | 19 | # Não podemos passar o self para o Estado pois se o contrato fosse |
44 | | - # alterado o estado anterior dele tambem seria alterado |
| 20 | + # alterado o estado anterior dele também seria alterado |
45 | 21 | return Estado( |
46 | | - Contrato( |
47 | | - data=self.__data, cliente=self.__cliente, tipo=self.__tipo |
48 | | - ) |
| 22 | + Contrato(data=self.data, cliente=self.cliente, tipo=self.tipo) |
49 | 23 | ) |
50 | 24 |
|
51 | 25 | def restaura_estado(self, estado): |
52 | | - self.__cliente = estado.contrato.cliente |
53 | | - self.__data = estado.contrato.data |
54 | | - self.__tipo = estado.contrato.tipo |
| 26 | + self.cliente = estado.contrato.cliente |
| 27 | + self.data = estado.contrato.data |
| 28 | + self.tipo = estado.contrato.tipo |
55 | 29 |
|
56 | 30 |
|
57 | 31 | class Estado: |
|
0 commit comments