当前位置: 首页>>代码示例>>C#>>正文


C# ISet.SetEquals方法代码示例

本文整理汇总了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();
            }
        }
开发者ID:w3he,项目名称:Bio.VCF,代码行数:36,代码来源:VariantContextAccessMethods.cs

示例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()));
            }
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:37,代码来源:TestIndexWriterUnicode.cs

示例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;
        }
开发者ID:destinyclown,项目名称:VBF,代码行数:17,代码来源:LR0Model.cs


注:本文中的ISet.SetEquals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。