本文整理汇总了C#中ISet.SetEquals方法的典型用法代码示例。如果您正苦于以下问题:C# ISet.SetEquals方法的具体用法?C# ISet.SetEquals怎么用?C# ISet.SetEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISet
的用法示例。
在下文中一共展示了ISet.SetEquals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SubContextFromSamples
/// <summary>
/// This method subsets down to a set of samples.
///
/// At the same time returns the alleles to just those in use by the samples,
/// if rederiveAllelesFromGenotypes is true, otherwise the full set of alleles
/// in this VC is returned as the set of alleles in the subContext, even if
/// some of those alleles aren't in the samples
///
/// WARNING: BE CAREFUL WITH rederiveAllelesFromGenotypes UNLESS YOU KNOW WHAT YOU ARE DOING
/// </summary>
/// <param name="sampleNames"> the sample names </param>
/// <param name="rederiveAllelesFromGenotypes"> if true, returns the alleles to just those in use by the samples, true should be default </param>
/// <returns> new VariantContext subsetting to just the given samples </returns>
public VariantContext SubContextFromSamples(ISet<string> sampleNames, bool rederiveAllelesFromGenotypes)
{
if (sampleNames.SetEquals(SampleNames) && !rederiveAllelesFromGenotypes)
{
return this; // fast path when you don't have any work to do
}
else
{
VariantContextBuilder builder = new VariantContextBuilder(this);
GenotypesContext newGenotypes = genotypes.subsetToSamples(sampleNames);
if (rederiveAllelesFromGenotypes)
{
builder.SetAlleles(allelesOfGenotypes(newGenotypes));
}
else
{
builder.SetAlleles(alleles);
}
builder.SetGenotypes(newGenotypes);
return builder.make();
}
}
示例2: 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.SetEquals(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()));
}
}
示例3: CheckExist
private bool CheckExist(ISet<LR0Item> set, out LR0State targetState)
{
bool exist = false;
targetState = null;
foreach (var state in m_states)
{
if (set.SetEquals(state.ItemSet))
{
exist = true;
targetState = state;
break;
}
}
return exist;
}