public static int Compare(SortKey sortkey1, SortKey sortkey2) { Contract.Ensures(-1 <= Contract.Result<int>()); Contract.Ensures(Contract.Result<int>() <= 1); return default(int); }
public static int Compare(SortKey sortkey1, SortKey sortkey2) { if ((sortkey1 == null) || (sortkey2 == null)) { throw new ArgumentNullException((sortkey1 == null) ? "sortkey1" : "sortkey2"); } byte[] keyData = sortkey1.m_KeyData; byte[] buffer2 = sortkey2.m_KeyData; if (keyData.Length == 0) { if (buffer2.Length == 0) { return(0); } return(-1); } if (buffer2.Length == 0) { return(1); } int num = (keyData.Length < buffer2.Length) ? keyData.Length : buffer2.Length; for (int i = 0; i < num; i++) { if (keyData[i] > buffer2[i]) { return(1); } if (keyData[i] < buffer2[i]) { return(-1); } } return(0); }
//////////////////////////////////////////////////////////////////////// // // Equals // // Implements Object.Equals(). Returns a boolean indicating whether // or not object refers to the same SortKey as the current instance. // //////////////////////////////////////////////////////////////////////// /// <include file='doc\SortKey.uex' path='docs/doc[@for="SortKey.Equals"]/*' /> public override bool Equals(Object value) { // // See if the object name is the same as the SortKey object. // if ((value != null) && (value is SortKey)) { SortKey Key = (SortKey)value; // // See if the member variables are equal. If so, then // return true. // if ((this.win32LCID == Key.win32LCID) && (this.options == Key.options) && (String.CompareOrdinal(this.m_String, Key.m_String) == 0)) { return(true); } } // // Objects are not the same, so return false. // return(false); }
/// <summary>Compares two sort keys.</summary> /// <returns>Value Condition Less than zero <paramref name="sortkey1" /> is less than <paramref name="sortkey2" />. Zero <paramref name="sortkey1" /> is equal to <paramref name="sortkey2" />. Greater than zero <paramref name="sortkey1" /> is greater than <paramref name="sortkey2" />. </returns> /// <param name="sortkey1">The first sort key to compare. </param> /// <param name="sortkey2">The second sort key to compare. </param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="sortkey1" /> or <paramref name="sortkey2" /> is null.</exception> public static int Compare(SortKey sortkey1, SortKey sortkey2) { if (sortkey1 == null) { throw new ArgumentNullException("sortkey1"); } if (sortkey2 == null) { throw new ArgumentNullException("sortkey2"); } if (object.ReferenceEquals(sortkey1, sortkey2) || object.ReferenceEquals(sortkey1.OriginalString, sortkey2.OriginalString)) { return(0); } byte[] keyData = sortkey1.KeyData; byte[] keyData2 = sortkey2.KeyData; int num = (keyData.Length <= keyData2.Length) ? keyData.Length : keyData2.Length; for (int i = 0; i < num; i++) { if (keyData[i] != keyData2[i]) { return((keyData[i] >= keyData2[i]) ? 1 : -1); } } return((keyData.Length != keyData2.Length) ? ((keyData.Length >= keyData2.Length) ? 1 : -1) : 0); }
public static int Compare(SortKey sortkey1, SortKey sortkey2) { if (sortkey1 == null) { throw new ArgumentNullException("sortkey1"); } if (sortkey2 == null) { throw new ArgumentNullException("sortkey2"); } if (Object.ReferenceEquals(sortkey1, sortkey2) || Object.ReferenceEquals(sortkey1.OriginalString, sortkey2.OriginalString)) { return(0); } byte [] d1 = sortkey1.KeyData; byte [] d2 = sortkey2.KeyData; int len = d1.Length > d2.Length ? d2.Length : d1.Length; for (int i = 0; i < len; i++) { if (d1 [i] != d2 [i]) { return(d1 [i] < d2 [i] ? -1 : 1); } } return(d1.Length == d2.Length ? 0 : d1.Length < d2.Length ? -1 : 1); }
public virtual SortKey GetSortKey(string source, CompareOptions options) { switch (options) { case CompareOptions.Ordinal: case CompareOptions.OrdinalIgnoreCase: throw new ArgumentException("Now allowed CompareOptions.", "options"); } #if !MOONLIGHT if (UseManagedCollation) { return(collator.GetSortKey(source, options)); } SortKey key = new SortKey(culture, source, options); /* Need to do the icall here instead of in the * SortKey constructor, as we need access to * this instance's collator. */ assign_sortkey(key, source, options); return(key); #else return(collator.GetSortKey(source, options)); #endif }
/// <summary>比较两个排序关键字。</summary> /// <returns>一个有符号的整数,它指明 <paramref name="sortkey1" /> 与 <paramref name="sortkey2" /> 之间的关系。值条件小于零 <paramref name="sortkey1" /> 小于 <paramref name="sortkey2" />。零 <paramref name="sortkey1" /> 等于 <paramref name="sortkey2" />。大于零 <paramref name="sortkey1" /> 大于 <paramref name="sortkey2" />。</returns> /// <param name="sortkey1">要比较的第一个排序字符串。</param> /// <param name="sortkey2">要比较的第二个排序字符串。</param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="sortkey1" /> or <paramref name="sortkey2" /> is null.</exception> public static int Compare(SortKey sortkey1, SortKey sortkey2) { if (sortkey1 == null || sortkey2 == null) { throw new ArgumentNullException(sortkey1 == null ? "sortkey1" : "sortkey2"); } byte[] numArray1 = sortkey1.m_KeyData; byte[] numArray2 = sortkey2.m_KeyData; if (numArray1.Length == 0) { return(numArray2.Length == 0 ? 0 : -1); } if (numArray2.Length == 0) { return(1); } int num = numArray1.Length < numArray2.Length ? numArray1.Length : numArray2.Length; for (int index = 0; index < num; ++index) { if ((int)numArray1[index] > (int)numArray2[index]) { return(1); } if ((int)numArray1[index] < (int)numArray2[index]) { return(-1); } } return(0); }
public static int Compare(SortKey sortkey1, SortKey sortkey2) { Contract.Ensures(-1 <= Contract.Result <int>()); Contract.Ensures(Contract.Result <int>() <= 1); return(default(int)); }
/// <summary>确定指定的对象是否等于当前的 <see cref="T:System.Globalization.SortKey" /> 对象。</summary> /// <returns>如果 <paramref name="value" /> 参数等于当前的 <see cref="T:System.Globalization.SortKey" /> 对象,则为 true;否则为 false。</returns> /// <param name="value">将与当前 <see cref="T:System.Globalization.SortKey" /> 对象进行比较的对象。 </param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="value" /> is null.</exception> public override bool Equals(object value) { SortKey sortkey2 = value as SortKey; if (sortkey2 != null) { return(SortKey.Compare(this, sortkey2) == 0); } return(false); }
//////////////////////////////////////////////////////////////////////// // // Equals // // Implements Object.Equals(). Returns a boolean indicating whether // or not object refers to the same SortKey as the current instance. // //////////////////////////////////////////////////////////////////////// public override bool Equals(Object value) { SortKey that = value as SortKey; if (that != null) { return(Compare(this, that) == 0); } return(false); }
SortKey CreateSortKeyCore (string source, CompareOptions options) { if (UseManagedCollation) return GetCollator ().GetSortKey (source, options); SortKey key=new SortKey (culture, source, options); /* Need to do the icall here instead of in the * SortKey constructor, as we need access to * this instance's collator. */ assign_sortkey (key, source, options); return(key); }
public static int Compare(SortKey sortkey1, SortKey sortkey2) { if (sortkey1 == null) { throw new ArgumentNullException("sortkey1"); } if (sortkey2 == null) { throw new ArgumentNullException("sortkey2"); } byte[] keydata1 = sortkey1.key; byte[] keydata2 = sortkey2.key; if (keydata1.Length == 0) { if (keydata2.Length == 0) { return(0); } return(-1); } int min_len = (keydata1.Length < keydata2.Length) ? keydata1.Length : keydata2.Length; for (int i = 0; i < min_len; i++) { if (keydata1[i] > keydata2[i]) { return(1); } else if (keydata1[i] < keydata2[i]) { return(-1); } } if (keydata1.Length < keydata2.Length) { return(-1); } else if (keydata1.Length > keydata2.Length) { return(1); } else { return(0); } }
/// <summary> /// Compares the two sort keys. Returns 0 if the two sort keys are /// equal, a number less than 0 if sortkey1 is less than sortkey2, /// and a number greater than 0 if sortkey1 is greater than sortkey2. /// </summary> public static int Compare(SortKey sortkey1, SortKey sortkey2) { ArgumentNullException.ThrowIfNull(sortkey1); ArgumentNullException.ThrowIfNull(sortkey2); byte[] key1Data = sortkey1._keyData; byte[] key2Data = sortkey2._keyData; Debug.Assert(key1Data != null, "key1Data != null"); Debug.Assert(key2Data != null, "key2Data != null"); // SortKey comparisons are done as an ordinal comparison by the raw sort key bytes. return(new ReadOnlySpan <byte>(key1Data).SequenceCompareTo(key2Data)); }
SortKey CreateSortKeyCore(string source, CompareOptions options) { if (UseManagedCollation) { return(GetCollator().GetSortKey(source, options)); } SortKey key = new SortKey(culture, source, options); /* Need to do the icall here instead of in the * SortKey constructor, as we need access to * this instance's collator. */ assign_sortkey(key, source, options); return(key); }
// copy from original SortKey.cs public override bool Equals(object value) { SortKey other = (value as SortKey); if (other != null) { if ((this.lcid == other.lcid) && (this.options == other.options) && (Compare(this, other) == 0)) { return(true); } } return(false); }
/// <summary> /// Compares the two sort keys. Returns 0 if the two sort keys are /// equal, a number less than 0 if sortkey1 is less than sortkey2, /// and a number greater than 0 if sortkey1 is greater than sortkey2. /// </summary> public static int Compare(SortKey sortkey1, SortKey sortkey2) { if (sortkey1 == null) { throw new ArgumentNullException(nameof(sortkey1)); } if (sortkey2 == null) { throw new ArgumentNullException(nameof(sortkey2)); } byte[] key1Data = sortkey1._keyData; byte[] key2Data = sortkey2._keyData; Debug.Assert(key1Data != null, "key1Data != null"); Debug.Assert(key2Data != null, "key2Data != null"); if (key1Data.Length == 0) { if (key2Data.Length == 0) { return(0); } return(-1); } if (key2Data.Length == 0) { return(1); } int compLen = (key1Data.Length < key2Data.Length) ? key1Data.Length : key2Data.Length; for (int i = 0; i < compLen; i++) { if (key1Data[i] > key2Data[i]) { return(1); } if (key1Data[i] < key2Data[i]) { return(-1); } } return(0); }
//////////////////////////////////////////////////////////////////////// // // Compare // // Compares the two sort keys. Returns 0 if the two sort keys are // equal, a number less than 0 if sortkey1 is less than sortkey2, // and a number greater than 0 if sortkey1 is greater than sortkey2. // //////////////////////////////////////////////////////////////////////// public static int Compare(SortKey sortkey1, SortKey sortkey2) { if (sortkey1 == null || sortkey2 == null) { throw new ArgumentNullException((sortkey1 == null ? "sortkey1": "sortkey2")); } Contract.EndContractBlock(); byte[] key1Data = sortkey1.m_KeyData; byte[] key2Data = sortkey2.m_KeyData; Contract.Assert(key1Data != null, "key1Data!=null"); Contract.Assert(key2Data != null, "key2Data!=null"); if (key1Data.Length == 0) { if (key2Data.Length == 0) { return(0); } return(-1); } if (key2Data.Length == 0) { return(1); } int compLen = (key1Data.Length < key2Data.Length)?key1Data.Length:key2Data.Length; for (int i = 0; i < compLen; i++) { if (key1Data[i] > key2Data[i]) { return(1); } if (key1Data[i] < key2Data[i]) { return(-1); } } return(0); }
public static int Compare (SortKey sortkey1, SortKey sortkey2) { if (sortkey1 == null) throw new ArgumentNullException ("sortkey1"); if (sortkey2 == null) throw new ArgumentNullException ("sortkey2"); if (Object.ReferenceEquals (sortkey1, sortkey2) || Object.ReferenceEquals (sortkey1.OriginalString, sortkey2.OriginalString)) return 0; byte [] d1 = sortkey1.KeyData; byte [] d2 = sortkey2.KeyData; int len = d1.Length > d2.Length ? d2.Length : d1.Length; for (int i = 0; i < len; i++) if (d1 [i] != d2 [i]) return d1 [i] < d2 [i] ? -1 : 1; return d1.Length == d2.Length ? 0 : d1.Length < d2.Length ? -1 : 1; }
public static int Compare(SortKey sk1, SortKey sk2) { if (Object.ReferenceEquals(sk1, sk2) || Object.ReferenceEquals(sk1.OriginalString, sk2.OriginalString)) { return(0); } byte [] d1 = sk1.KeyData; byte [] d2 = sk2.KeyData; int len = d1.Length > d2.Length ? d2.Length : d1.Length; for (int i = 0; i < len; i++) { if (d1 [i] != d2 [i]) { return(d1 [i] < d2 [i] ? -1 : 1); } } return(d1.Length == d2.Length ? 0 : d1.Length < d2.Length ? -1 : 1); }
public static int Compare (SortKey sortkey1, SortKey sortkey2) { if (sortkey1 == null) { throw new ArgumentNullException ("sortkey1"); } if (sortkey2 == null) { throw new ArgumentNullException ("sortkey2"); } byte[] keydata1 = sortkey1.key; byte[] keydata2 = sortkey2.key; if (keydata1.Length == 0) { if (keydata2.Length == 0) { return 0; } return -1; } int min_len = (keydata1.Length < keydata2.Length) ? keydata1.Length : keydata2.Length; for (int i = 0; i < min_len; i++) { if (keydata1[i] > keydata2[i]) { return 1; } else if (keydata1[i] < keydata2[i]) { return -1; } } if (keydata1.Length < keydata2.Length) { return -1; } else if (keydata1.Length > keydata2.Length) { return 1; } else { return 0; } }
public XmlStringSortKey(SortKey sortKey, bool descendingOrder) { _sortKey = sortKey; _descendingOrder = descendingOrder; }
public virtual SortKey GetSortKey(string source, CompareOptions options) { switch (options) { case CompareOptions.Ordinal: case CompareOptions.OrdinalIgnoreCase: throw new ArgumentException ("Now allowed CompareOptions.", "options"); } #if !MOONLIGHT if (UseManagedCollation) return collator.GetSortKey (source, options); SortKey key=new SortKey (culture, source, options); /* Need to do the icall here instead of in the * SortKey constructor, as we need access to * this instance's collator. */ assign_sortkey (key, source, options); return(key); #else return collator.GetSortKey (source, options); #endif }
public static int Compare (SortKey! sortkey1, SortKey! sortkey2) { CodeContract.Requires(sortkey1 != null); CodeContract.Requires(sortkey2 != null); return default(int); }
//////////////////////////////////////////////////////////////////////// // // Compare // // Compares the two sort keys. Returns 0 if the two sort keys are // equal, a number less than 0 if sortkey1 is less than sortkey2, // and a number greater than 0 if sortkey1 is greater than sortkey2. // //////////////////////////////////////////////////////////////////////// public static int Compare(SortKey sortkey1, SortKey sortkey2) { if (sortkey1==null || sortkey2==null) { throw new ArgumentNullException((sortkey1 == null ? nameof(sortkey1) : nameof(sortkey2))); } Contract.EndContractBlock(); byte[] key1Data = sortkey1._keyData; byte[] key2Data = sortkey2._keyData; Contract.Assert(key1Data != null, "key1Data != null"); Contract.Assert(key2Data != null, "key2Data != null"); if (key1Data.Length == 0) { if (key2Data.Length == 0) { return (0); } return (-1); } if (key2Data.Length == 0) { return (1); } int compLen = (key1Data.Length<key2Data.Length)?key1Data.Length:key2Data.Length; for (int i=0; i<compLen; i++) { if (key1Data[i]>key2Data[i]) { return (1); } if (key1Data[i]<key2Data[i]) { return (-1); } } return 0; }
/// <summary> /// Compares the two sort keys. Returns 0 if the two sort keys are /// equal, a number less than 0 if sortkey1 is less than sortkey2, /// and a number greater than 0 if sortkey1 is greater than sortkey2. /// </summary> public static int Compare(SortKey sortkey1 !!, SortKey sortkey2 !!)
public static int Compare(SortKey sortkey1, SortKey sortkey2) { throw new PlatformNotSupportedException(); }
/// <summary>Compares two sort keys.</summary><returns>A signed integer that indicates the relationship between <paramref name="sortkey1" /> and <paramref name="sortkey2" />.Value Condition Less than zero <paramref name="sortkey1" /> is less than <paramref name="sortkey2" />. Zero <paramref name="sortkey1" /> is equal to <paramref name="sortkey2" />. Greater than zero <paramref name="sortkey1" /> is greater than <paramref name="sortkey2" />. </returns><param name="sortkey1">The first sort key to compare. </param><param name="sortkey2">The second sort key to compare. </param><exception cref="T:System.ArgumentNullException"><paramref name="sortkey1" /> or <paramref name="sortkey2" /> is null.</exception> public static int Compare(SortKey sortkey1, SortKey sortkey2) { throw new NotImplementedException(); }
/// <summary>Determines whether the specified object is equal to the current <see cref="T:System.Globalization.SortKey" /> object.</summary> /// <param name="value">The object to compare with the current <see cref="T:System.Globalization.SortKey" /> object. </param> /// <returns> /// <see langword="true" /> if the <paramref name="value" /> parameter is equal to the current <see cref="T:System.Globalization.SortKey" /> object; otherwise, <see langword="false" />. </returns> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="value" /> is <see langword="null" />.</exception> // Token: 0x06003044 RID: 12356 RVA: 0x000B90B4 File Offset: 0x000B72B4 public override bool Equals(object value) { SortKey sortKey = value as SortKey; return(sortKey != null && SortKey.Compare(this, sortKey) == 0); }
public static int Compare(SortKey sortkey1, SortKey sortkey2) { Contract.Requires(sortkey1 != null); Contract.Requires(sortkey2 != null); return(default(int)); }
/// <summary>Determines whether the specified object is equal to the current <see cref="T:System.Globalization.SortKey" /> object.</summary> /// <returns>true if the <paramref name="value" /> parameter is equal to the current <see cref="T:System.Globalization.SortKey" /> object; otherwise, false. </returns> /// <param name="value">The object to compare with the current <see cref="T:System.Globalization.SortKey" /> object. </param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="value" /> is null.</exception> public override bool Equals(object value) { SortKey sortKey = value as SortKey; return(sortKey != null && this.lcid == sortKey.lcid && this.options == sortKey.options && SortKey.Compare(this, sortKey) == 0); }
public override bool Equals(object value) { SortKey key = value as SortKey; return((key != null) && (Compare(this, key) == 0)); }
public static int Compare(SortKey sortkey1, SortKey sortkey2);
public XmlStringSortKey(SortKey sortKey, bool descendingOrder) { this.sortKey = sortKey; this.descendingOrder = descendingOrder; }
//////////////////////////////////////////////////////////////////////// // // Compare // // Compares the two sort keys. Returns 0 if the two sort keys are // equal, a number less than 0 if sortkey1 is less than sortkey2, // and a number greater than 0 if sortkey1 is greater than sortkey2. // //////////////////////////////////////////////////////////////////////// public static int Compare(SortKey sortkey1, SortKey sortkey2) { if (sortkey1==null || sortkey2==null) { throw new ArgumentNullException((sortkey1==null ? "sortkey1": "sortkey2")); } byte[] key1Data = sortkey1.m_KeyData; byte[] key2Data = sortkey2.m_KeyData; BCLDebug.Assert(key1Data!=null, "key1Data!=null"); BCLDebug.Assert(key2Data!=null, "key2Data!=null"); if (key1Data.Length == 0) { if (key2Data.Length == 0) { return (0); } return (-1); } if (key2Data.Length == 0) { return (1); } int compLen = (key1Data.Length<key2Data.Length)?key1Data.Length:key2Data.Length; for (int i=0; i<compLen; i++) { if (key1Data[i]>key2Data[i]) { return (1); } if (key1Data[i]<key2Data[i]) { return (-1); } } return 0; }