prepare application

This commit is contained in:
2019-07-08 12:12:13 +02:00
parent 756ba2175d
commit 04c1d777e4
12 changed files with 446 additions and 415 deletions

22
src/MyPriorityQueue.py Normal file
View File

@ -0,0 +1,22 @@
import queue
class MyPriorityQueueItem(object):
def __init__(self, itemWithPriority):
self.itemWithPriority = itemWithPriority
def __lt__(self, other): return self.itemWithPriority.priority < other.itemWithPriority.priority
def __le__(self, other): return self.itemWithPriority.priority <= other.itemWithPriority.priority
def __eq__(self, other): return self.itemWithPriority.priority == other.itemWithPriority.priority
def __ne__(self, other): return self.itemWithPriority.priority != other.itemWithPriority.priority
def __gt__(self, other): return self.itemWithPriority.priority > other.itemWithPriority.priority
def __ge__(self, other): return self.itemWithPriority.priority >= other.itemWithPriority.priority
class MyPriorityQueue(queue.PriorityQueue):
def _put(self, itemWithPriority):
i = MyPriorityQueueItem(itemWithPriority)
super()._put(i)
def _get(self):
i = super()._get()
return i.itemWithPriority