feat: repr, eq and iter for fifo queue
This commit is contained in:
parent
4b29fb6d08
commit
a71b476652
@ -23,6 +23,17 @@ class FifoValuation:
|
|||||||
def __init__(self, state: Optional[List[FifoBin]]):
|
def __init__(self, state: Optional[List[FifoBin]]):
|
||||||
self.queue: List[FifoBin] = state if state is not None else []
|
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]:
|
def get_state(self) -> List[FifoBin]:
|
||||||
"""Get current state of queue."""
|
"""Get current state of queue."""
|
||||||
return self.queue
|
return self.queue
|
||||||
|
Loading…
Reference in New Issue
Block a user