protected override int CompareSpecific(ComparisonKey that, ComparisonLevel level) { var thisMz = ((PrecursorLibraryKey)LibraryKey).Mz; var thatMz = ((PrecursorLibraryKey)that.LibraryKey).Mz; return(thisMz.CompareTo(thatMz)); }
protected override int CompareSpecific(ComparisonKey that, ComparisonLevel level) { var thisPreferredKey = ((MoleculeLibraryKey)LibraryKey).PreferredKey; var thatPreferredKey = ((MoleculeLibraryKey)that.LibraryKey).PreferredKey; return(string.CompareOrdinal(thisPreferredKey, thatPreferredKey)); }
protected override int CompareSpecific(ComparisonKey other, ComparisonLevel level) { var that = (Peptide)other; int result = StringComparer.Ordinal.Compare(PeptideLibraryKey.UnmodifiedSequence, that.PeptideLibraryKey.UnmodifiedSequence); if (result != 0 || level <= ComparisonLevel.UnmodifiedSequence) { return(result); } result = CompareModificationIndexes(that); if (result != 0 || level <= ComparisonLevel.PrecisionIndependentModifications) { return(result); } return(result); }
public int Compare(ComparisonKey that, ComparisonLevel level) { int result = KeyType.CompareTo(that.KeyType); if (result != 0 || level <= ComparisonLevel.KeyType) { return(result); } result = CompareSpecific(that, level); if (result != 0 || level < ComparisonLevel.Adduct) { return(result); } result = Adduct.CompareTo(that.Adduct); if (result != 0 || level <= ComparisonLevel.Adduct) { return(result); } return(result); }
/// <summary> /// Compares the portion of the key which is specific to the type of LibraryKey. /// </summary> protected virtual int CompareSpecific(ComparisonKey other, ComparisonLevel level) { return(0); }
private static Comparer <ComparisonKey> MakeComparer(ComparisonLevel comparisonLevel) { return(Comparer <ComparisonKey> .Create((key1, key2) => key1.Compare(key2, comparisonLevel))); }
private RangeList SearchEntries(ComparisonKey comparisonKey, ComparisonLevel level) { return(new RangeList(CollectionUtil.BinarySearch(_allEntries, item => item.Key.Compare(comparisonKey, level)))); }
protected RangeList SearchEntries(LibraryKey libraryKey, ComparisonLevel level) { return(SearchEntries(ComparisonKey.Get(libraryKey), level)); }