Class Sorter<T>
A Sorter<T> implements the generic IComparer<T> interface to compare two objects of type T, using a caller-supplied sort specification (which includes the fields to consider during sorting, and the sort direction). A field value resolver then is used to retrieve, for a specific field, the value of that field in each of the two instaces which are currently compared.
Implements
Inherited Members
Namespace: SdlSdl.LanguagePlatformTranslationMemory
Assembly: Sdl.LanguagePlatform.TranslationMemory.dll
Syntax
public class Sorter<T> : IComparer<T>
Type Parameters
Name | Description |
---|---|
T |
Constructors
Sorter(IFieldValueComparer<T>, SortSpecification)
Initializes a new instance of the Sorter class with a specified comparer and sort specification.
Declaration
public Sorter(IFieldValueComparer<T> comparer, SortSpecification sortSpecification)
Parameters
Type | Name | Description |
---|---|---|
IFieldValueComparer | comparer | The field comparer object used for sorting. |
SortSpecification | sortSpecification | The sort specification. |
Sorter(IFieldValueComparer<T>, SortSpecification, SortDisambiguator)
Initializes a new instance of the Sorter class with a specified comparer and sort specification.
Declaration
public Sorter(IFieldValueComparer<T> comparer, SortSpecification sortSpecification, SortDisambiguator sortDisambiguator)
Parameters
Type | Name | Description |
---|---|---|
IFieldValueComparer | comparer | The field comparer object used for sorting. |
SortSpecification | sortSpecification | The sort specification. |
SortDisambiguator | sortDisambiguator | An optional disambiguator which is called if the sort criteria do not sufficiently define the sort order between two search result objects. |
Methods
Compare(T, T)
Compares the two items and returns an indication of their relative value.
Declaration
public int Compare(T x, T y)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first of the two items to compare. |
T | y | The second of the two items to compare. |
Returns
Type | Description |
---|---|
int | Less than zero if x is less than y, zero if x equals y, greater than zero if x is greater than y. |