Interface ISorted<T>
A sorted collection, i.e. a collection where items are maintained and can be searched for in sorted order. Thus the sequence order is given as a sorting order.
The sorting order is defined by a comparer, an object of type IComparer<T> (C5.IComparer`1). Implementors of this interface will normally let the user define the comparer as an argument to a constructor. Usually there will also be constructors without a comparer argument, in which case the comparer should be the defalt comparer for the item type, C5.Comparer`1.Default.
The comparer of the sorted collection is available as the
System.Collections.Generic.Comparer
property
(C5.ISorted`1.Comparer).
The methods are grouped according to
Since this interface extends ISequenced<T>, sorted collections will also have an item equalityComparer (C5.IExtensible`1.EqualityComparer). This equalityComparer will not be used in connection with the inner workings of the sorted collection, but will be used if the sorted collection is used as an item in a collection of unsequenced or sequenced collections, (C5.ICollection`1 and C5.ISequenced`1)
Note that code may check if two sorted collections has the same sorting order by checking if the Comparer properties are equal. This is done a few places in this library for optimization purposes.
Inherited Members
Assembly: DistributedLucene.Net.dll
Syntax
public interface ISorted<T> : ISequenced<T>, ICollection<T>, IExtensible<T>, Collections.Generic.ICollection<T>, IDirectedCollectionValue<T>, ICollectionValue<T>, IShowable, IFormattable, IDirectedEnumerable<T>, Collections.Generic.IEnumerable<T>
Type Parameters
Name | Description |
---|---|
T |
Properties
Name | Description |
---|---|
Comparer | The comparer object supplied at creation time for this sorted collection. |
Methods
Name | Description |
---|---|
AddSorted(Collections.Generic.IEnumerable<T>) | Add all the items from another collection with an enumeration order that is increasing in the items. |
Cut(IComparable<T>, out T, out Boolean, out T, out Boolean) | Given a "cut" function from the items of the sorted collection to
whose only sign changes when going through items in increasing order
can be
The "cut" function is supplied as the method
of an object implementing
.
A typical example is the case where is comparable and
is itself of type .
This method performs a search in the sorted collection for the ranges in which the "cut" function is negative, zero respectively positive. If is comparable
and is of type , this is a safe way (no exceptions thrown)
to find predecessor and successor of .
If the supplied cut function does not satisfy the sign-change condition, the result of this call is undefined. |
DeleteMax() | Remove the largest item from this sorted collection. |
DeleteMin() | Remove the least item from this sorted collection. |
FindMax() | Find the current largest item of this sorted collection. |
FindMin() | Find the current least item of this sorted collection. |
Predecessor(T) | Find the strict predecessor in the sorted collection of a particular value, that is, the largest item in the collection less than the supplied value. |
RangeAll() | Create a directed collection with the same items as this collection. The returned collection is not a copy but a view into the collection. The view is fragile in the sense that changes to the underlying collection will invalidate the view so that further operations on the view throws InvalidView exceptions. |
RangeFrom(T) | Query this sorted collection for items greater than or equal to a supplied value. The returned collection is not a copy but a view into the collection. The view is fragile in the sense that changes to the underlying collection will invalidate the view so that further operations on the view throws InvalidView exceptions. |
RangeFromTo(T, T) | Query this sorted collection for items between two supplied values. The returned collection is not a copy but a view into the collection. The view is fragile in the sense that changes to the underlying collection will invalidate the view so that further operations on the view throws InvalidView exceptions. |
RangeTo(T) | Query this sorted collection for items less than a supplied value. The returned collection is not a copy but a view into the collection. The view is fragile in the sense that changes to the underlying collection will invalidate the view so that further operations on the view throws InvalidView exceptions. |
RemoveRangeFrom(T) | Remove all items of this collection above or at a supplied threshold. |
RemoveRangeFromTo(T, T) | Remove all items of this collection between two supplied thresholds. |
RemoveRangeTo(T) | Remove all items of this collection below a supplied threshold. |
Successor(T) | Find the strict successor in the sorted collection of a particular value, that is, the least item in the collection greater than the supplied value. |
TryPredecessor(T, out T) | Find the strict predecessor of item in the sorted collection, that is, the greatest item in the collection smaller than the item. |
TrySuccessor(T, out T) | Find the strict successor of item in the sorted collection, that is, the least item in the collection greater than the supplied value. |
TryWeakPredecessor(T, out T) | Find the weak predecessor of item in the sorted collection, that is, the greatest item in the collection smaller than or equal to the item. |
TryWeakSuccessor(T, out T) | Find the weak successor of item in the sorted collection, that is, the least item in the collection greater than or equal to the supplied value. |
WeakPredecessor(T) | Find the weak predecessor in the sorted collection of a particular value, that is, the largest item in the collection less than or equal to the supplied value. |
WeakSuccessor(T) | Find the weak successor in the sorted collection of a particular value, that is, the least item in the collection greater than or equal to the supplied value. |