def _put(self, item, heappush=heapq.heappush):
        #unique items added to list without checks
        if item[1] not in self.locations:
            self.locations.append(item[1])
            self.itemsInQueue.append(item)
            PriorityQueue._put(self, item, heappush)

        #if already in list, then only insert if
        #quality is higher than what is already in list
        elif item[1] in self.locations:
            if abs(item[0]) < abs( self.itemsInQueue[ self.locations.index(item[1]) ][0] ):
                pass #no insertion, correlation is lower than what is already in list
            else:

                tmpItem = self.itemsInQueue.pop( self.locations.index(item[1]) )
                self.queue.remove( tmpItem )
                self.locations.remove(item[1])

                self.locations.append(item[1])
                self.itemsInQueue.append(item)
                PriorityQueue._put(self, item, heappush)
Beispiel #2
0
    def _put(self, item, heappush=heapq.heappush):
        #unique items added to list without checks
        if item[1] not in self.locations:
            self.locations.append(item[1])
            self.itemsInQueue.append(item)
            PriorityQueue._put(self, item, heappush)

        #if already in list, then only insert if
        #quality is higher than what is already in list
        elif item[1] in self.locations:
            if abs(item[0]) < abs(self.itemsInQueue[self.locations.index(
                    item[1])][0]):
                pass  #no insertion, correlation is lower than what is already in list
            else:

                tmpItem = self.itemsInQueue.pop(self.locations.index(item[1]))
                self.queue.remove(tmpItem)
                self.locations.remove(item[1])

                self.locations.append(item[1])
                self.itemsInQueue.append(item)
                PriorityQueue._put(self, item, heappush)
Beispiel #3
0
 def _put(self, item, heappush=heapq.heappush):
     if item[1] not in self.values:
         self.values.add(item[1])
         PriorityQueue._put(self, item, heappush)
     else:
         pass
Beispiel #4
0
 def _put(self, prioritized_item, heappush=heapq.heappush):
     priority = prioritized_item[0]
     data = prioritized_item[1]
     item = (priority, self._counter, data)
     self._counter += 1
     PriorityQueue._put(self, item, heappush)
Beispiel #5
0
 def _put(self, item, heappush=heapq.heappush):
     if item[1] not in self.values:
         self.values.add(item[1])
         PriorityQueue._put(self, item, heappush)
     else:
         pass