本文整理汇总了C#中Fingerprint.Equivalent方法的典型用法代码示例。如果您正苦于以下问题:C# Fingerprint.Equivalent方法的具体用法?C# Fingerprint.Equivalent怎么用?C# Fingerprint.Equivalent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fingerprint
的用法示例。
在下文中一共展示了Fingerprint.Equivalent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEquivalence
public void TestEquivalence()
{
Fingerprint fp1 = new Fingerprint(65);
Fingerprint fp2 = new Fingerprint(65);
Fingerprint fp3 = new Fingerprint(64);
Fingerprint fp4 = new Fingerprint(66);
// Reference first
Assert.True(fp1.Equivalent(fp1));
Assert.True(fp2.Equivalent(fp2));
Assert.True(fp3.Equivalent(fp3));
Assert.True(fp4.Equivalent(fp4));
// Length second
Assert.True(fp3.Equivalent(fp1));
Assert.False(fp1.Equivalent(fp3));
Assert.False(fp4.Equivalent(fp2));
Assert.True(fp2.Equivalent(fp4));
// Bits third
Assert.True(fp1.Equivalent(fp2));
Assert.True(fp2.Equivalent(fp1));
fp1.Touch(32);
Assert.False(fp1.Equivalent(fp2));
Assert.True(fp2.Equivalent(fp1));
fp2.Touch(32);
Assert.True(fp1.Equivalent(fp2));
Assert.True(fp2.Equivalent(fp1));
fp2.Touch(31);
Assert.True(fp1.Equivalent(fp2));
Assert.False(fp2.Equivalent(fp1));
fp4.Touch(31);
fp4.Touch(32);
fp4.Touch(33);
Assert.True(fp2.Equivalent(fp4));
Assert.False(fp4.Equivalent(fp2));
}
示例2: Equivalent
/// <summary>
/// Determines whether the specified Cell object is equivalent to this
/// one based on the given fingerprint.
/// </summary>
public bool Equivalent(Cell other, Fingerprint fingerprint)
{
if (!other.IsKindOf(this))
{
return false;
}
if (!fingerprint.Equivalent(other.fingerprint))
{
return false;
}
return IsEquivalent(other, fingerprint);
}