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


C# HashSet.addAll方法代码示例

本文整理汇总了C#中HashSet.addAll方法的典型用法代码示例。如果您正苦于以下问题:C# HashSet.addAll方法的具体用法?C# HashSet.addAll怎么用?C# HashSet.addAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HashSet的用法示例。


在下文中一共展示了HashSet.addAll方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getUndefined

		/**
		 * Return those entities that are used, but not defined.
		 */
		public Collection getUndefined() 
		{
			HashSet result = new HashSet();
			result.addAll(use.getCollection());
			result.removeAll(def.getCollection());
			return result;
		}
开发者ID:cwi-swat,项目名称:jjtraveler-csharp,代码行数:10,代码来源:DefUse.cs

示例2: getAllFiled

		/// <summary>
		/// 获取一个类的所有字段
		/// </summary>
		/// <param name="entityClass">
		/// 
		/// @return </param>
		public static ISet<Field> getAllFiled(Type entityClass)
		{

			// 获取本类的所有字段
			ISet<Field> fs = new HashSet<Field>();
			foreach (Field f in entityClass.GetFields())
			{
				fs.Add(f);
			}
			foreach (Field f in entityClass.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance))
			{
				fs.Add(f);
			}

			// 递归获取父类的所有字段
			Type superClass = entityClass.BaseType;
			if (!superClass.Equals(typeof(object)))
			{
				ISet<Field> superFileds = getAllFiled(superClass);
				fs.addAll(superFileds);
			}

			return fs;
		}
开发者ID:yuzukwok,项目名称:disconf.net,代码行数:30,代码来源:ClassUtils.cs

示例3: _minimizeRuleSet

        public virtual HashSet<Rule> _minimizeRuleSet( CompositeGrammarTree p )
        {
            var refs = new HashSet<Rule>();
            foreach ( GrammarAST refAST in p.grammar.ruleRefs )
            {
                System.Console.Out.WriteLine( "ref " + refAST.Text + ": " + refAST.NFAStartState +
                                   " enclosing rule: " + refAST.NFAStartState.enclosingRule +
                                   " invoking rule: " + ( (NFAState)refAST.NFAStartState.transition[0].target ).enclosingRule );
                refs.Add( ( (NFAState)refAST.NFAStartState.transition[0].target ).enclosingRule );
            }

            if ( p.children != null )
            {
                foreach ( CompositeGrammarTree @delegate in p.children )
                {
                    var delegateRuleRefs = _minimizeRuleSet( @delegate );
                    refs.addAll( delegateRuleRefs );
                }
            }

            return refs;
        }
开发者ID:mahanteshck,项目名称:antlrcs,代码行数:22,代码来源:CompositeGrammar.cs

示例4: calcVCFGenotypeKeys

		/// <summary>
		/// Determine which genotype fields are in use in the genotypes in VC </summary>
		/// <param name="vc"> </param>
		/// <returns> an ordered list of genotype fields in use in VC.  If vc has genotypes this will always include GT first </returns>
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
//ORIGINAL LINE: public static List<String> calcVCFGenotypeKeys(final VariantContext vc, final VCFHeader header)
		public static IList<string> calcVCFGenotypeKeys(VariantContext vc, VCFHeader header)
		{
			Set<string> keys = new HashSet<string>();

			bool sawGoodGT = false;
			bool sawGoodQual = false;
			bool sawGenotypeFilter = false;
			bool sawDP = false;
			bool sawAD = false;
			bool sawPL = false;
			foreach (Genotype g in vc.Genotypes)
			{
				keys.addAll(g.ExtendedAttributes.Keys);
				if (g.Available)
				{
					sawGoodGT = true;
				}
				if (g.hasGQ())
				{
					sawGoodQual = true;
				}
				if (g.hasDP())
				{
					sawDP = true;
				}
				if (g.hasAD())
				{
					sawAD = true;
				}
				if (g.hasPL())
				{
					sawPL = true;
				}
				if (g.Filtered)
				{
					sawGenotypeFilter = true;
				}
			}

			if (sawGoodQual)
			{
				keys.add(VCFConstants.GENOTYPE_QUALITY_KEY);
			}
			if (sawDP)
			{
				keys.add(VCFConstants.DEPTH_KEY);
			}
			if (sawAD)
			{
				keys.add(VCFConstants.GENOTYPE_ALLELE_DEPTHS);
			}
			if (sawPL)
			{
				keys.add(VCFConstants.GENOTYPE_PL_KEY);
			}
			if (sawGenotypeFilter)
			{
				keys.add(VCFConstants.GENOTYPE_FILTER_KEY);
			}

			IList<string> sortedList = ParsingUtils.sortList(new List<string>(keys));

			// make sure the GT is first
			if (sawGoodGT)
			{
				IList<string> newList = new List<string>(sortedList.Count + 1);
				newList.Add(VCFConstants.GENOTYPE_KEY);
				newList.AddRange(sortedList);
				sortedList = newList;
			}

			if (sortedList.Count == 0 && header.hasGenotypingData())
			{
				// this needs to be done in case all samples are no-calls
				return Collections.singletonList(VCFConstants.GENOTYPE_KEY);
			}
			else
			{
				return sortedList;
			}
		}
开发者ID:w3he,项目名称:Bio.VCF,代码行数:87,代码来源:VCFWriter.cs

示例5: ruleNames2

 protected HashSet<string> ruleNames2( System.Collections.IEnumerable rules )
 {
     HashSet<string> x = new HashSet<string>();
     foreach ( System.Collections.IEnumerable s in rules )
     {
         x.addAll( ruleNames( s ) );
     }
     return x;
 }
开发者ID:JSchofield,项目名称:antlrcs,代码行数:9,代码来源:TestDFAConversion.cs

示例6: testCopyJDKSet

        /// <summary>
        /// Test the static #copy() function with a JDK <seealso cref="Set"/> as a source
        /// </summary>
        public virtual void testCopyJDKSet()
        {
            ISet<string> set = new HashSet<string>();

            IList<string> stopwords = TEST_STOP_WORDS;
            IList<string> stopwordsUpper = new List<string>();
            foreach (string @string in stopwords)
            {
              stopwordsUpper.Add(@string.ToUpper(Locale.ROOT));
            }
            set.addAll(TEST_STOP_WORDS);

            CharArraySet copy = CharArraySet.copy(TEST_VERSION_CURRENT, set);

            assertEquals(set.Count, copy.size());
            assertEquals(set.Count, copy.size());

            assertTrue(copy.containsAll(stopwords));
            foreach (string @string in stopwordsUpper)
            {
              assertFalse(copy.contains(@string));
            }

            IList<string> newWords = new List<string>();
            foreach (string @string in stopwords)
            {
              newWords.Add(@string + "_1");
            }
            copy.addAll(newWords);

            assertTrue(copy.containsAll(stopwords));
            assertTrue(copy.containsAll(newWords));
            // new added terms are not in the source set
            foreach (string @string in newWords)
            {
              assertFalse(set.Contains(@string));
            }
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:41,代码来源:TestCharArraySet.cs

示例7: removeDuplicates

 /**
  * Removes duplicates.
  * @param list of terms
  * @return duplicate free list
  */
 private List<String> removeDuplicates( List<String> list) {
     HashSet<String> hs = new HashSet<String>();
    hs.addAll(list);
    list.clear();
    list.addAll(hs);
    return list;
 }
开发者ID:FabianSperrle,项目名称:WATIS,代码行数:12,代码来源:IntervalCreation.cs

示例8: GetImportedRulesSensitiveToOverriddenRulesDueToLOOK

 public Set<Rule> GetImportedRulesSensitiveToOverriddenRulesDueToLOOK()
 {
     Set<String> diffFIRSTs = getOverriddenRulesWithDifferentFIRST();
     Set<Rule> rules = new HashSet();
     for (Iterator it = diffFIRSTs.iterator(); it.hasNext();) {
         String r = (String) it.next();
         for (int i = 0; i < delegates.size(); i++) {
             Grammar g = delegates.get(i);
             Set<Rule> callers = g.ruleSensitivity.get(r);
             // somebody invokes rule whose FIRST changed in subgrammar?
             if ( callers!=null ) {
                 rules.addAll(callers);
                 //[email protected](g.name+" rules "+callers+" sensitive to "+r+"; dup 'em");
             }
         }
     }
     return rules;
 }
开发者ID:bszafko,项目名称:antlrcs,代码行数:18,代码来源:LL1Analyzer.cs

示例9: OR

 public OR( SemanticContext a, SemanticContext b )
 {
     _operands = new HashSet<object>();
     if ( a is OR )
     {
         _operands.addAll( ( (OR)a )._operands );
     }
     else if ( a != null )
     {
         _operands.Add( a );
     }
     if ( b is OR )
     {
         _operands.addAll( ( (OR)b )._operands );
     }
     else if ( b != null )
     {
         _operands.Add( b );
     }
 }
开发者ID:bszafko,项目名称:antlrcs,代码行数:20,代码来源:SemanticContext.cs

示例10: MinimizeRuleSetCore

        protected virtual void MinimizeRuleSetCore( HashSet<string> ruleDefs,
                                     CompositeGrammarTree p )
        {
            HashSet<string> localRuleDefs = new HashSet<string>();
            HashSet<string> overrides = new HashSet<string>();
            // compute set of non-overridden rules for this delegate
            foreach ( Rule r in p.grammar.Rules )
            {
                if ( !ruleDefs.Contains( r.Name ) )
                {
                    localRuleDefs.Add( r.Name );
                }
                else if ( !r.Name.Equals( Grammar.ArtificialTokensRuleName ) )
                {
                    // record any overridden rule 'cept tokens rule
                    overrides.Add( r.Name );
                }
            }
            //System.Console.Out.WriteLine( "rule defs for " + p.grammar.name + ": " + localRuleDefs );
            //System.Console.Out.WriteLine( "overridden rule for " + p.grammar.name + ": " + overrides );
            p.grammar.overriddenRules = overrides;

            // make set of all rules defined thus far walking delegation tree.
            // the same rule in two delegates resolves in favor of first found
            // in tree therefore second must not be included
            ruleDefs.addAll( localRuleDefs );

            // pass larger set of defined rules to delegates
            if ( p.children != null )
            {
                foreach ( CompositeGrammarTree @delegate in p.children )
                {
                    MinimizeRuleSetCore( ruleDefs, @delegate );
                }
            }
        }
开发者ID:bszafko,项目名称:antlrcs,代码行数:36,代码来源:CompositeGrammar.cs


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