示例#1
0
文件: Key.cs 项目: pwdlugosz/Horse
 /// <summary>
 /// Compares two keys only on their field offsets, and their affinities; if one is smaller than the other, then it ignores the values in the larger key past the smaller's max index
 /// </summary>
 /// <param name="K1">The left key</param>
 /// <param name="K2">The right key</param>
 /// <returns>Boolean indicating if both keys are the same</returns>
 public static bool SubsetStrong(Key K1, Key K2)
 {
     int n = Math.Min(K1.Count, K2.Count);
     for (int i = 0; i < n; i++)
         if (K1[i] != K2[i] || K1.Affinity(i) != K2.Affinity(i)) return false;
     return true;
 }
示例#2
0
文件: Key.cs 项目: pwdlugosz/Horse
 /// <summary>
 /// Compares two keys only on their field offsets, and their affinities
 /// </summary>
 /// <param name="K1">The left key</param>
 /// <param name="K2">The right key</param>
 /// <returns>Boolean indicating if both keys are the same</returns>
 public static bool EqualsStrict(Key K1, Key K2)
 {
     int n = Math.Min(K1.Count, K2.Count);
     int o = Math.Max(K1.Count, K2.Count);
     if (n == 0 && o != 0) return false;
     for (int i = 0; i < n; i++)
         if (K1[i] != K2[i] || K1.Affinity(i) != K2.Affinity(i)) return false;
     return true;
 }