Class PriorityComparer<T>
An adapter comparer for use with ValuePriorityQueue<T>.
This comparer makes it easy to convert PriorityQueue<T>-derived subclasses into comparers that can be used with ValuePriorityQueue<T>. NOTE: This adapter converts the 2-state LessThan(T, T) method to the 3-state Compare(T, T) by always assuming if LessThan(T, T) returnsfalse
that the left node is greater than
the right node. This means nodes will never compare equal, even if they actually are.
Therefore, it may not work correctly for most applications of IComparer<T>,
but will work correctly with ValuePriorityQueue<T>.
Implements
IComparer<T>
Inherited Members
Namespace: Lucene.Net.Util
Assembly: Lucene.Net.dll
Syntax
public abstract class PriorityComparer<T> : IComparer<T>
Type Parameters
Name | Description |
---|---|
T | The type of item to compare. This may be either a value type or a reference type. |
Methods
LessThan(T, T)
Determines the ordering of objects in this priority queue. Subclasses must define this one method.
Declaration
protected abstract bool LessThan(T a, T b)
Parameters
Type | Name | Description |
---|---|---|
T | a | The left value to compare. |
T | b | The right value to compare. |
Returns
Type | Description |
---|---|
bool |
|