83 lines
2.0 KiB
Python
83 lines
2.0 KiB
Python
class Garbagetruck:
|
|
image: object
|
|
position: object
|
|
trashweight: int
|
|
trash: list
|
|
capacity: int
|
|
|
|
def __init__(self):
|
|
self.capacity: int = 20
|
|
self.trash: list = []
|
|
self.trashweight: int = 0
|
|
self.image: object = None
|
|
self.position: object = None
|
|
self.route = None
|
|
self.scanner = None
|
|
self.planner = None
|
|
self.driver = None
|
|
|
|
def getCapacity(self) -> int:
|
|
return self.capacity
|
|
|
|
def getTrash(self) -> list:
|
|
return self.trash
|
|
|
|
def setTrash(self, trash: list) -> None:
|
|
self.trash = trash
|
|
for item in trash:
|
|
self.addTrashweight(item.getWeight)
|
|
|
|
def addTrash(self, trash: object) -> None:
|
|
self.trash.append(trash)
|
|
self.addTrashweight(trash.getWeight)
|
|
|
|
def removeTrash(self, trashid: int) -> object:
|
|
trash = self.trash.pop(trashid)
|
|
self.addTrashweight(trash.getWeight * (-1))
|
|
return trash
|
|
|
|
def getTrashweight(self) -> int:
|
|
return self.trashweight
|
|
|
|
def setTrashweight(self, weight: int) -> None:
|
|
self.trashweight = weight
|
|
|
|
def addTrashweight(self, weight: int) -> None:
|
|
self.trashweight += weight
|
|
|
|
def getImage(self) -> object:
|
|
return self.image
|
|
|
|
def setImage(self, image: object) -> None:
|
|
self.image = image
|
|
|
|
def getPosition(self) -> object:
|
|
return self.position
|
|
|
|
def setPosition(self, position: object) -> None:
|
|
self.position = position
|
|
|
|
def getRoute(self):
|
|
return self.route
|
|
|
|
def setRoute(self, route) -> None:
|
|
self.route = route
|
|
|
|
def getScanner(self):
|
|
return self.scanner
|
|
|
|
def setScanner(self, scanner) -> None:
|
|
self.route = scanner
|
|
|
|
def getPlanner(self):
|
|
return self.planner
|
|
|
|
def setPlanner(self, planner) -> None:
|
|
self.route = planner
|
|
|
|
def getDriver(self):
|
|
return self.driver
|
|
|
|
def setDriver(self, driver) -> None:
|
|
self.route = driver
|