lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "oramas martín" <>
Subject Reordering elements in a PriorityQueue
Date Mon, 17 Apr 2006 15:30:29 GMT
Hi all,

I would like to insert elements in a PriorityQueue where the value returned
by the 'lessThan' method for the same both objects can change over the time.
Just to clarify my problem, I would like to insert PriorityQueue objects in
the main PriorityQueue, so the 'lessThan' method from the main queue will
compare the top objects of the inserted priority queues.

So I would like to reorder an alement already in the queue, each time it is
detected a change in its value. AFAIK, it can not be done with the current
PriorityQueue implementation, so I have, apparently, two ways of doing it,
one can be remove the affected element and reinsert it, and the other is to
implement a reorder method. In either case I have to implement a new method,
but my understanding of the queue implementation is too low to decide what
of them is a better approach. ¿Can somebody points me in the right
direccion, explaining a bit how the queue works (upHeap and downHeap) or how
to implement the methods I need?

Thanks for your help,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message