59 lines
1.2 KiB
Python
59 lines
1.2 KiB
Python
class Household:
|
|
def __init__(self):
|
|
self.id: int = 0
|
|
self.image: object = None
|
|
self.position: tuple = None
|
|
self.neighbours: list = []
|
|
self.garbage: object = None
|
|
|
|
def setNeighbours(self, neighbours):
|
|
self.neighbours = neighbours
|
|
return self
|
|
|
|
def addNeighbour(self, neighbour):
|
|
self.neighbours.append(neighbour)
|
|
return self
|
|
|
|
def getNeighbours(self):
|
|
return self.neighbours
|
|
|
|
def setPosition(self, position: tuple):
|
|
self.position = position
|
|
return self
|
|
|
|
def getPosition(self):
|
|
return self.position
|
|
|
|
def setImage(self, image: object):
|
|
self.image = image
|
|
return self
|
|
|
|
def getImage(self):
|
|
return self.image
|
|
|
|
def setId(self, newID: int):
|
|
self.id = newID
|
|
return self
|
|
|
|
def getId(self):
|
|
return self.id
|
|
|
|
def setGarbage(self, garbage: object):
|
|
self.garbage = garbage
|
|
return self
|
|
|
|
def getGarbage(self):
|
|
return self.garbage
|
|
|
|
|
|
def generateHousehold(i, image, position):
|
|
"""
|
|
:param int i:
|
|
:param object image:
|
|
:param tuple position:
|
|
:return:
|
|
"""
|
|
house = Household()
|
|
house.setId(i).setImage(image).setPosition(position)
|
|
return house
|