本文整理汇总了C#中System.MulticastDelegate.BaseEquals方法的典型用法代码示例。如果您正苦于以下问题:C# MulticastDelegate.BaseEquals方法的具体用法?C# MulticastDelegate.BaseEquals怎么用?C# MulticastDelegate.BaseEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.MulticastDelegate
的用法示例。
在下文中一共展示了MulticastDelegate.BaseEquals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: KPM
/*
* Perform a slightly crippled version of
* Knuth-Pratt-Morris over MulticastDelegate chains.
* Border values are set as pointers in kpm_next;
* Generally, KPM border arrays are length n+1 for
* strings of n. This one works with length n at the
* expense of a few additional comparisions.
*/
private static MulticastDelegate KPM (MulticastDelegate needle, MulticastDelegate haystack,
out MulticastDelegate tail)
{
MulticastDelegate nx, hx;
// preprocess
hx = needle;
nx = needle.kpm_next = null;
do {
while ((nx != null) && (!nx.BaseEquals (hx)))
nx = nx.kpm_next;
hx = hx.prev;
if (hx == null)
break;
nx = nx == null ? needle : nx.prev;
if (hx.BaseEquals (nx))
hx.kpm_next = nx.kpm_next;
else
hx.kpm_next = nx;
} while (true);
// match
MulticastDelegate match = haystack;
nx = needle;
hx = haystack;
do {
while (nx != null && !nx.BaseEquals (hx)) {
nx = nx.kpm_next;
match = match.prev;
}
nx = nx == null ? needle : nx.prev;
if (nx == null) {
// bingo
tail = hx.prev;
return match;
}
hx = hx.prev;
} while (hx != null);
tail = null;
return null;
}