本文整理汇总了C#中ISet.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# ISet.Equals方法的具体用法?C# ISet.Equals怎么用?C# ISet.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISet
的用法示例。
在下文中一共展示了ISet.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckTermsOrder
private void CheckTermsOrder(IndexReader r, ISet<string> allTerms, bool isTop)
{
TermsEnum terms = MultiFields.GetFields(r).Terms("f").Iterator(null);
BytesRef last = new BytesRef();
HashSet<string> seenTerms = new HashSet<string>();
while (true)
{
BytesRef term = terms.Next();
if (term == null)
{
break;
}
Assert.IsTrue(last.CompareTo(term) < 0);
last.CopyBytes(term);
string s = term.Utf8ToString();
Assert.IsTrue(allTerms.Contains(s), "term " + TermDesc(s) + " was not added to index (count=" + allTerms.Count + ")");
seenTerms.Add(s);
}
if (isTop)
{
Assert.IsTrue(allTerms.Equals(seenTerms));
}
// Test seeking:
IEnumerator<string> it = seenTerms.GetEnumerator();
while (it.MoveNext())
{
BytesRef tr = new BytesRef(it.Current);
Assert.AreEqual(TermsEnum.SeekStatus.FOUND, terms.SeekCeil(tr), "seek failed for term=" + TermDesc(tr.Utf8ToString()));
}
}
示例2: areIsomorphic
public static bool areIsomorphic(ISet<RDFTriple> graph1, ISet<RDFTriple> graph2)
{
if(graph1==null)return graph2==null;
if(graph1.Equals(graph2))return true;
// Graphs must have the same size to be isomorphic
if(graph1.Count!=graph2.Count)return false;
foreach(var triple in graph1){
// do a strict comparison
if(triple.getSubject().getKind()!=RDFTerm.BLANK &&
triple.getObject().getKind()!=RDFTerm.BLANK){
if(!graph2.Contains(triple))
return false;
} else {
// do a lax comparison
bool found=false;
foreach(var triple2 in graph2){
if(laxEqual(triple,triple2)){
found=true;
break;
}
}
if(!found)return false;
}
}
return true;
}