feat: repr, eq and iter for fifo queue

This commit is contained in:
Ankush Menat 2021-12-18 19:33:58 +05:30 committed by Ankush Menat
parent 4b29fb6d08
commit a71b476652

View File

@ -23,6 +23,17 @@ class FifoValuation:
def __init__(self, state: Optional[List[FifoBin]]):
self.queue: List[FifoBin] = state if state is not None else []
def __repr__(self):
return str(self.queue)
def __iter__(self):
return iter(self.queue)
def __eq__(self, other):
if isinstance(other, list):
return self.queue == other
return self.queue == other.queue
def get_state(self) -> List[FifoBin]:
"""Get current state of queue."""
return self.queue