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


C# ISet.Remove方法代码示例

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


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

示例1: ladderLength

        /**
         * Latest update: June 19, 2015
         * Try to learn how to code in 10 minutes in C# using other people's idea and code
         *
         * code source:
         * http://shanjiaxin.blogspot.ca/2014/04/word-ladder-leetcode.html
         *
         * Bug: Time Limit Exceeded
         */
        public static int ladderLength(String beginWord, String endWord, ISet<String> wordDict)
        {
            if (beginWord == null || endWord == null || wordDict == null || wordDict.Count == 0)
            {
                return 0;
            }

            Queue<String> queue = new Queue<string>();

            queue.Enqueue(beginWord);
            wordDict.Remove(beginWord);

            int length = 1;

            while ( queue.Count > 0 )
            {
                int count = queue.Count;

                // Check each adjacent string
                for (int i = 0; i < count; i++) // julia comment: BFS, each layer visit each node
                {
                    String current = queue.Dequeue();
                    // Check if there's adjacent string
                    for (int j = 0; j < current.Length; j++)
                    {
                        for (char c = 'a'; c <= 'z'; c++)
                        {
                            if (c == current[j])
                            {
                                continue;
                            }

                            String temp = replace(current, j, c);
                            if (temp.CompareTo(endWord) ==0)
                            {
                                return length + 1;
                            }

                            if (wordDict.Contains(temp))
                            {
                                queue.Enqueue(temp);
                                wordDict.Remove(temp);
                            }
                        }
                    }
                }
                length++; // julia comment: BFS, go to next layer
            }
            return 0;
        }
开发者ID:jianminchen,项目名称:word-ladder-I,代码行数:59,代码来源:Program.cs

示例2: LadderLength

 public int LadderLength(string start, string end, ISet<string> dict)
 {
     var queue = new Queue<string>();
     queue.Enqueue(start);
     dict.Add(end);
     int step = 0;
     while (queue.Count != 0)
     {
         var level = new Queue<string>();
         step++;
         while (queue.Count != 0)
         {
             String q = queue.Dequeue();
             if (q.Equals(end))
                 return step;
             for (int i = 0; i < start.Length; i++)
             {
                 for (char c = 'a'; c <= 'z'; c++)
                 {
                     String s = q.Substring(0, i) + c + q.Substring(i + 1, start.Length - 1 - i);
                     if (dict.Contains(s))
                     {
                         level.Enqueue(s);
                         dict.Remove(s);
                     }
                 }
             }
         }
         queue = level;
     }
     return 0;
 }
开发者ID:YouenZeng,项目名称:LeetCode,代码行数:32,代码来源:WordLadderSolution.cs

示例3: CheckRecursion

        private void CheckRecursion(Spreadsheet spreadsheet, Cell current, ISet<CellAddress> stack)
        {
            try
            {
                var dependencies = PooledHashSet<CellAddress>.GetInstance();
                try
                {
                    GetDependencies(current.Expression, dependencies);
                    if (dependencies.Overlaps(stack))
                        throw new CircularCellRefereceException(Resources.CircularReference);

                    stack.Add(current.Address);
                    foreach (var address in dependencies)
                    {
                        CheckRecursion(spreadsheet, spreadsheet[address], stack);
                    }
                    stack.Remove(current.Address);
                }
                finally
                {
                    dependencies.Free();
                }
            }
            catch (CircularCellRefereceException ex)
            {
                throw SpreadsheetException.AddCellAddressToErrorStack(ex, current.Address);
            }
        }
开发者ID:AndreyTretyak,项目名称:SpreadsheetSimulator,代码行数:28,代码来源:RecursionDetectionValidator.cs

示例4: FindDirectCircularReferences

 private static void FindDirectCircularReferences(ISet<Node> childList1, ISet<Node> childList2)
 {
     while (true)
     {
         var circularRefs = new List<Tuple<Node, Node>>();
         foreach (var node in childList1)
         {
             foreach (var node2 in from node2 in childList2.Where(n => n != node) where node.SiblingDependencies.Contains(node2) where node2.SiblingDependencies.Contains(node) where circularRefs.All(x => x.Item1 != node2 && x.Item2 != node) select node2)
             {
                 circularRefs.Add(new Tuple<Node, Node>(node, node2));
             }
         }
         var circularDependencyHolders = new HashSet<Node>();
         //May need to check for circular references with the newly created CircularDependencyHolderNode?
         foreach (var circularRef in circularRefs)
         {
             var circularDependencyHolderNode = new CircularDependencyHolderNode(new List<Node> {circularRef.Item1, circularRef.Item2});
             circularDependencyHolderNode.SiblingDependencies.UnionWith(circularRef.Item1.SiblingDependencies.Union(circularRef.Item2.SiblingDependencies));
             childList2.Add(circularDependencyHolderNode);
             circularDependencyHolderNode.SiblingDependencies.Remove(circularRef.Item1);
             circularDependencyHolderNode.SiblingDependencies.Remove(circularRef.Item2);
             childList2.Remove(circularRef.Item1);
             childList2.Remove(circularRef.Item2);
             foreach (var node3 in childList2.Where(n => n != circularDependencyHolderNode))
             {
                 var containedNode1 = node3.SiblingDependencies.Contains(circularRef.Item1);
                 var containedNode2 = node3.SiblingDependencies.Contains(circularRef.Item2);
                 if (containedNode1 || containedNode2)
                     node3.SiblingDependencies.Add(circularDependencyHolderNode);
                 if (containedNode1)
                     node3.SiblingDependencies.Remove(circularRef.Item1);
                 if (containedNode2)
                     node3.SiblingDependencies.Remove(circularRef.Item2);
             }
             circularDependencyHolders.Add(circularDependencyHolderNode);
         }
         if (circularDependencyHolders.Any() && circularDependencyHolders != childList2)
             childList1 = circularDependencyHolders;
         else
             break;
     }
 }
开发者ID:davidkron,项目名称:DevArch,代码行数:42,代码来源:CircularReferenceFinder.cs

示例5: replaceBlankNodes

   /**
      *  Replaces certain blank nodes with blank nodes whose
      *  names meet the N-Triples requirements
      * @param triples A set of RDF triples
      * @param bnodeLabels A mapping of blank node names
      * already allocated.  This method will modify this
      * _object as needed to allocate new blank nodes.
      */
   internal static void replaceBlankNodes(ISet<RDFTriple> triples,
 IDictionary<string,RDFTerm> bnodeLabels)
   {
       if(bnodeLabels.Count==0)
         return;
       IDictionary<string,RDFTerm> newBlankNodes=new PeterO.Support.LenientDictionary<string,RDFTerm>();
       IList<RDFTriple[]> changedTriples=new List<RDFTriple[]>();
       int[] nodeindex=new int[]{0};
       foreach(var triple in triples){
         bool changed=false;
         RDFTerm subj=triple.getSubject();
         if(subj.getKind()==RDFTerm.BLANK){
       string oldname=subj.getValue();
       string newname=suggestBlankNodeName(oldname,nodeindex,bnodeLabels);
       if(!newname.Equals(oldname)){
         RDFTerm newNode=newBlankNodes[oldname];
         if(newNode==null){
       newNode=RDFTerm.fromBlankNode(newname);
       bnodeLabels.Add(newname, newNode);
       newBlankNodes.Add(oldname, newNode);
         }
         subj=newNode;
         changed=true;
       }
         }
         RDFTerm obj=triple.getObject();
         if(obj.getKind()==RDFTerm.BLANK){
       string oldname=obj.getValue();
       string newname=suggestBlankNodeName(oldname,nodeindex,bnodeLabels);
       if(!newname.Equals(oldname)){
         RDFTerm newNode=newBlankNodes[oldname];
         if(newNode==null){
       newNode=RDFTerm.fromBlankNode(newname);
       bnodeLabels.Add(newname, newNode);
       newBlankNodes.Add(oldname, newNode);
         }
         obj=newNode;
         changed=true;
       }
         }
         if(changed){
       RDFTriple[] newTriple=new RDFTriple[]{triple,
       new RDFTriple(subj,triple.getPredicate(),obj)
       };
       changedTriples.Add(newTriple);
         }
       }
       foreach(var triple in changedTriples){
         triples.Remove(triple[0]);
         triples.Add(triple[1]);
       }
   }
开发者ID:peteroupc,项目名称:HtmlParserCSharp,代码行数:60,代码来源:RDFInternal.cs

示例6: LadderLength

    public int LadderLength(string beginWord, string endWord, ISet<string> wordList)
    {
        if(string.IsNullOrEmpty(beginWord)||string.IsNullOrEmpty(endWord)||wordList.Count==0||beginWord.Length==0||endWord.Length==0)
            return 0;
        Queue<String> queue=new Queue<String>();
        queue.Enqueue(beginWord);
        queue.Enqueue(" ");
        int res=1;
        while(queue.Count!=0)
        {
            string str=queue.Peek();
            queue.Dequeue();
            if(str!=" ")
            {
                for(int i=0;i<str.Length;i++)
                {
                    char tmp=str[i];
                    for(char c='a';c<='z';c++)
                    {
                        if(c==tmp)
                            continue;
                        str=str.Remove(i).Insert(i,new String(c,1));
                        if(str==endWord)
                            return res+1;
                        if(wordList.Contains(str))
                        {
                            queue.Enqueue(str);
                            wordList.Remove(str);
                        }
                        str=str.Remove(i).Insert(i,new String(tmp,1));
                    }
                }
            }
            else if (queue.Count!=0)
            {
                res++;
                queue.Enqueue(" ");
            }

        }
        return 0;
    }
开发者ID:gaufung,项目名称:LeetCodeCSharp,代码行数:42,代码来源:127WordLadder.cs

示例7: LadderLengthRecur

        public int LadderLengthRecur(string beginWord, string endWord, ISet<string> wordList, HashSet<string> eSet)
        {
            int diff = scmp(beginWord, endWord);
            if (diff == 0)
                return 1;
            else if (diff == 1)
                return 2;

            List<string> lt = wordList.ToList();

            int minval = 0;
            foreach (var item in lt)
            {
                if (scmp(item, beginWord) == 1 && !eSet.Contains(item))
                {
                    wordList.Remove(item);
                    eSet.Add(item);
                    int val = LadderLengthRecur(item, endWord, wordList, eSet);
                    if (val != 0)
                    {
                        if (minval == 0)
                            minval = val;
                        else if (minval > val)
                            minval = val;
                        if (minval == 2)
                            return 3;
                    }
                    eSet.Remove(item);
                    wordList.Add(item);                        
                }
            }
            if (minval == 0)
                return 0;

            return minval + 1;
        }
开发者ID:aribeth97,项目名称:leetcode-CSharp,代码行数:36,代码来源:Solution127.cs

示例8: CheckExplicitAnyPolicy

        private static bool CheckExplicitAnyPolicy(ISet<string> declaredPolicies)
        {
            if (declaredPolicies == null)
            {
                return false;
            }

            return declaredPolicies.Remove(Oids.AnyCertPolicy);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:9,代码来源:CertificatePolicy.cs

示例9: Resolve

        private void Resolve(object obj, IList<Tuple<object, DtoMetadata>> ancestors, ISet<object> ancestorsFastLookup)
        {
            if (obj == null || obj is string || ancestorsFastLookup.Contains(obj))
            {
                return;
            }

            var metadata = _cache.GetMetadataFor(obj.GetType());
            if (metadata == null)
            {
                return;
            }

            var refData = metadata.GetAttribute<ReferenceDataAttribute>();
            if (refData != null && !refData.HasUpdateableForeignKeys)
            {
                return;
            }

            ancestors.Add(new Tuple<object, DtoMetadata>(obj, metadata));
            ancestorsFastLookup.Add(obj);
            foreach (var property in metadata.WriteableProperties)
            {
                if (property.HasAttribute<SimpleSaveIgnoreAttribute>() || property.HasAttribute<DoNotAutoWireExplicitTransitiveBackReferenceAttribute>())
                {
                    continue;
                }

                refData = property.GetAttribute<ReferenceDataAttribute>();
                if (refData != null && !refData.HasUpdateableForeignKeys)
                {
                    continue;
                }

                var fkAttribute = property.GetAttribute<ForeignKeyReferenceAttribute>();
                var drill = true;
                if (fkAttribute != null)
                {
                    var propertyType = property.Prop.PropertyType;
                    if (propertyType.IsValueType)
                    {
                        AssignAnyMismatchedExplicitTransitiveForeignKeyValues(obj, ancestors, fkAttribute, propertyType, property);
                        drill = false;
                    }
                }
                else if (property.IsValueType || property.IsString)
                {
                    drill = false;
                }

                if (drill)
                {
                    if (property.IsEnumerable)
                    {
                        var children = property.GetValue(obj) as IEnumerable;
                        if (children != null)
                        {
                            foreach (var child in children)
                            {
                                Resolve(child, ancestors, ancestorsFastLookup);
                            }
                        }
                    }
                    else
                    {
                        Resolve(property.GetValue(obj), ancestors, ancestorsFastLookup);
                    }
                }
            }

            ancestors.RemoveAt(ancestors.Count - 1);
            ancestorsFastLookup.Remove(obj);
        }
开发者ID:Paymentsense,项目名称:Dapper.SimpleSave,代码行数:73,代码来源:ExplicitTransitiveBackReferenceResolver.cs

示例10: ParseAndResolveVariables

            private string ParseAndResolveVariables(string strVal, ISet visitedPlaceholders)
            {
                if (strVal == null)
                {
                    return null;
                }

                int startIndex = strVal.IndexOf(owner.placeholderPrefix);
                while (startIndex != -1)
                {
                    int endIndex = strVal.IndexOf(
                        owner.placeholderSuffix, startIndex + owner.placeholderPrefix.Length);
                    if (endIndex != -1)
                    {
                        int pos = startIndex + owner.placeholderPrefix.Length;
                        string placeholder = strVal.Substring(pos, endIndex - pos);
                        if (visitedPlaceholders.Contains(placeholder))
                        {
                            throw new ObjectDefinitionStoreException(
                                string.Format(
                                    CultureInfo.InvariantCulture,
                                    "Circular placeholder reference '{0}' detected. ",
                                    placeholder));
                        }
                        visitedPlaceholders.Add(placeholder);

                        if (variableSource.CanResolveVariable(placeholder))
                        {
                            string resolvedValue = variableSource.ResolveVariable(placeholder);
                            resolvedValue = ParseAndResolveVariables(resolvedValue, visitedPlaceholders);

                            #region Instrumentation

                            if (logger.IsDebugEnabled)
                            {
                                logger.Debug(string.Format(
                                                 CultureInfo.InvariantCulture,
                                                 "Resolving placeholder '{0}' to '{1}'.", placeholder, resolvedValue));
                            }

                            #endregion

                            if (resolvedValue == null
                                && startIndex == 0
                                && strVal.Length <= endIndex + owner.placeholderSuffix.Length)
                            {
                                return null;
                            }
                            strVal = strVal.Substring(0, startIndex) + resolvedValue + strVal.Substring(endIndex + owner.placeholderSuffix.Length);
                            startIndex = strVal.IndexOf(owner.placeholderPrefix, startIndex + (resolvedValue == null ? 0 : resolvedValue.Length));
                        }
                        else if (owner.ignoreUnresolvablePlaceholders)
                        {
                            // simply return the unprocessed value...
                            return strVal;
                        }
                        else
                        {
                            throw new ObjectDefinitionStoreException(string.Format(
                                                                         CultureInfo.InvariantCulture,
                                                                         "Could not resolve placeholder '{0}'.", placeholder));
                        }
                        visitedPlaceholders.Remove(placeholder);
                    }
                    else
                    {
                        startIndex = -1;
                    }
                }
                return strVal;
            }            
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:71,代码来源:VariablePlaceholderConfigurer.cs

示例11: U2

 static void U2(int[] w_mas, int[] d_mas, int[] h_mas, ISet<Paralepiped> SetP, ISet<Paralepiped> SetF, char[] color)
 {
     //Устанавливает все паралепипеды с 2 цветами
     for (int i = 1; i < w_mas.Length - 1; i++)
         foreach (Paralepiped P in SetP)
             if (Turn2(2, 4, P, color) == true)
             {
                 SetP.Remove(P);
                 P.SetXYZ(w_mas[i - 1], 0, 0);
                 w_mas[i] = P.GetW() + w_mas[i - 1];
                 SetF.Add(P);
                 break;
             }
     for (int i = 1; i < d_mas.Length - 1; i++)
         foreach (Paralepiped P in SetP)
             if (Turn2(0, 4, P, color) == true)
             {
                 SetP.Remove(P);
                 P.SetXYZ(0, d_mas[i - 1], 0);
                 d_mas[i] = P.GetD() + d_mas[i - 1];
                 SetF.Add(P);
                 break;
             }
     for (int i = 1; i < h_mas.Length - 1; i++)
         foreach (Paralepiped P in SetP)
             if (Turn2(0, 2, P, color) == true)
             {
                 SetP.Remove(P);
                 P.SetXYZ(0, 0, h_mas[i - 1]);
                 h_mas[i] = P.GetH() + h_mas[i - 1];
                 SetF.Add(P);
                 break;
             }
     //--------------------------------------------------------------------------------------
     for (int i = 1; i < w_mas.Length - 1; i++)
         foreach (Paralepiped P in SetP)
             if (Turn2(2, 5, P, color) == true && P.GetW() == w_mas[i] - w_mas[i - 1])
             {
                 SetP.Remove(P);
                 P.SetXYZ(w_mas[i - 1], 0, (h_mas.Length < 2) ? 0 : h_mas[h_mas.Length - 2]);
                 SetF.Add(P);
                 break;
             }
     for (int i = 1; i < w_mas.Length - 1; i++)
         foreach (Paralepiped P in SetP)
             if (Turn2(3, 4, P, color) == true && P.GetW() == w_mas[i] - w_mas[i - 1])
             {
                 SetP.Remove(P);
                 P.SetXYZ(w_mas[i - 1], (d_mas.Length < 2) ? 0 : d_mas[d_mas.Length - 2], 0);
                 SetF.Add(P);
                 break;
             }
     for (int i = 1; i < w_mas.Length - 1; i++)
         foreach (Paralepiped P in SetP)
             if (Turn2(3, 5, P, color) == true && P.GetW() == w_mas[i] - w_mas[i - 1])
             {
                 SetP.Remove(P);
                 P.SetXYZ(w_mas[i - 1], (d_mas.Length < 2) ? 0 : d_mas[d_mas.Length - 2], (h_mas.Length < 2) ? 0 : h_mas[h_mas.Length - 2]);
                 SetF.Add(P);
                 break;
             }
     //--------------------------------------------------------------------------------------------------------------------
     for (int i = 1; i < d_mas.Length - 1; i++)
         foreach (Paralepiped P in SetP)
             if (Turn2(0, 5, P, color) == true && P.GetD() == d_mas[i] - d_mas[i - 1])
             {
                 SetP.Remove(P);
                 P.SetXYZ(0, d_mas[i - 1], (h_mas.Length < 2) ? 0 : h_mas[h_mas.Length - 2]);
                 SetF.Add(P);
                 break;
             }
     for (int i = 1; i < d_mas.Length - 1; i++)
         foreach (Paralepiped P in SetP)
             if (Turn2(1, 4, P, color) == true && P.GetD() == d_mas[i] - d_mas[i - 1])
             {
                 SetP.Remove(P);
                 P.SetXYZ((w_mas.Length < 2) ? 0 : w_mas[w_mas.Length - 2], d_mas[i - 1], 0);
                 SetF.Add(P);
                 break;
             }
     for (int i = 1; i < d_mas.Length - 1; i++)
         foreach (Paralepiped P in SetP)
             if (Turn2(1, 5, P, color) == true && P.GetD() == d_mas[i] - d_mas[i - 1])
             {
                 SetP.Remove(P);
                 P.SetXYZ((w_mas.Length < 2) ? 0 : w_mas[w_mas.Length - 2], d_mas[i - 1], (h_mas.Length < 2) ? 0 : h_mas[h_mas.Length - 2]);
                 SetF.Add(P);
                 break;
             }
     //----------------------------------------------------------------------------------------------------------------------
     for (int i = 1; i < h_mas.Length - 1; i++)
         foreach (Paralepiped P in SetP)
             if (Turn2(0, 3, P, color) == true && P.GetH() == h_mas[i] - h_mas[i - 1])
             {
                 SetP.Remove(P);
                 P.SetXYZ(0, (d_mas.Length < 2) ? 0 : d_mas[d_mas.Length - 2], h_mas[i - 1]);
                 SetF.Add(P);
                 break;
             }
     for (int i = 1; i < h_mas.Length - 1; i++)
//.........这里部分代码省略.........
开发者ID:Rast1234,项目名称:2013,代码行数:101,代码来源:Klyukin_Evgenijj_YUrevich.cs

示例12: Algorithm

        static void Algorithm(ISet<Paralepiped> SetP, ISet<Paralepiped> SetF, Paralepiped FulP)
        {
            char[] color = FulP.GetColor();
            //подсчитываем колличество паралепипедов на стыках сторон
            int n_d = 0, n_w = 0, n_h = 0;
            foreach (Paralepiped P in SetP)
            {
                if (P.TestColor(2, new char[] { color[0], color[2] }) == true)
                    n_h++;
                if (P.TestColor(2, new char[] { color[2], color[4] }) == true)
                    n_w++;
                if (P.TestColor(2, new char[] { color[0], color[4] }) == true)
                    n_d++;
            }
            int[] h_mas = new int[n_h];
            int[] d_mas = new int[n_d];
            int[] w_mas = new int[n_w];

            //-------------------------------------------------------------------------------------------------
            //устанавливаем паралепипеды с 3 цветами
            for (int i = 0; i < 2; i++)
                for (int j = 2; j < 4; j++)
                    for (int k = 4; k < 6; k++)
                        foreach (Paralepiped P in SetP)
                            if (Turn3(i, j, k, P, color) == true)
                            {
                                SetP.Remove(P);
                                P.SetXYZ((i == 0) ? 0 : FulP.GetW() - P.GetW(), (j == 2) ? 0 : FulP.GetD() - P.GetD(), (k == 4) ? 0 : FulP.GetH() - P.GetH());
                                w_mas[(i == 0) ? 0 : w_mas.Length - 1] = (i == 0) ? P.GetW() : FulP.GetW();
                                d_mas[(j == 2) ? 0 : d_mas.Length - 1] = (j == 2) ? P.GetD() : FulP.GetD();
                                h_mas[(k == 4) ? 0 : h_mas.Length - 1] = (k == 4) ? P.GetH() : FulP.GetH();
                                SetF.Add(P);
                                break;
                            }
            //------------------------------------------------------------------------------------------------
            U2(w_mas, d_mas, h_mas, SetP, SetF, color);
            U1(w_mas, d_mas, h_mas, SetP, SetF, color);
            //устанавливаем паралепипеды без цветов
            for (int i = 1; i < w_mas.Length - 1; i++)
                for (int j = 1; j < d_mas.Length - 1; j++)
                    for (int k = 1; k < h_mas.Length - 1; k++)
                        foreach (Paralepiped P in SetP)
                            if (P.TestSize(w_mas[i] - w_mas[i - 1], d_mas[j] - d_mas[j - 1], h_mas[k] - h_mas[k - 1]) == true)
                            {
                                SetP.Remove(P);
                                if (P.GetW() != w_mas[i] - w_mas[i - 1])
                                    if (P.GetH() == w_mas[i] - w_mas[i - 1])
                                        P.TurnVertical();
                                    else
                                        P.TurnHorisontal1();
                                if (P.GetH() != h_mas[k] - h_mas[k - 1])
                                    P.TurnHorisontal();
                                P.SetXYZ(w_mas[i - 1], d_mas[j - 1], h_mas[k - 1]);
                                SetF.Add(P);
                                break;
                            }
        }
开发者ID:Rast1234,项目名称:2013,代码行数:57,代码来源:Klyukin_Evgenijj_YUrevich.cs

示例13: RemoveSelfLoops

		private static void RemoveSelfLoops(ISet<Production> productions) {
			var toDelete = new List<Production>();
			foreach (var production in productions) {
				if (production.IsSelfLoop) {
					toDelete.Add(production);
				}
			}
			foreach (var item in toDelete) {
				productions.Remove(item);
			}			
		}
开发者ID:ellisonch,项目名称:CFGLib,代码行数:11,代码来源:CFGtoCNF.cs

示例14: ScanAttributes

        /// <summary>
        /// Scans specified type for occurences of <see cref="QuerySqlFieldAttribute"/>.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="fields">The fields.</param>
        /// <param name="indexes">The indexes.</param>
        /// <param name="parentPropName">Name of the parent property.</param>
        /// <param name="visitedTypes">The visited types.</param>
        private static void ScanAttributes(Type type, List<QueryField> fields, List<QueryIndexEx> indexes, 
            string parentPropName, ISet<Type> visitedTypes)
        {
            Debug.Assert(type != null);
            Debug.Assert(fields != null);
            Debug.Assert(indexes != null);

            if (visitedTypes.Contains(type))
                throw new InvalidOperationException("Recursive Query Field definition detected: " + type);

            visitedTypes.Add(type);

            foreach (var memberInfo in GetFieldsAndProperties(type))
            {
                var customAttributes = memberInfo.Key.GetCustomAttributes(true);

                foreach (var attr in customAttributes.OfType<QuerySqlFieldAttribute>())
                {
                    var columnName = attr.Name ?? memberInfo.Key.Name;

                    // Dot notation is required for nested SQL fields
                    if (parentPropName != null)
                        columnName = parentPropName + "." + columnName;

                    fields.Add(new QueryField(columnName, memberInfo.Value));

                    if (attr.IsIndexed)
                        indexes.Add(new QueryIndexEx(columnName, attr.IsDescending, QueryIndexType.Sorted,
                            attr.IndexGroups));

                    ScanAttributes(memberInfo.Value, fields, indexes, columnName, visitedTypes);
                }

                foreach (var attr in customAttributes.OfType<QueryTextFieldAttribute>())
                {
                    var columnName = attr.Name ?? memberInfo.Key.Name;

                    // No dot notation for FullText index names
                    indexes.Add(new QueryIndexEx(columnName, false, QueryIndexType.FullText, null));

                    if (parentPropName != null)
                        columnName = parentPropName + "." + columnName;

                    fields.Add(new QueryField(columnName, memberInfo.Value));

                    ScanAttributes(memberInfo.Value, fields, indexes, columnName, visitedTypes);
                }
            }

            visitedTypes.Remove(type);
        }
开发者ID:ghostler,项目名称:ignite,代码行数:59,代码来源:QueryEntity.cs

示例15: ProcessChangedFile

 private void ProcessChangedFile(String file, WatcherChangeTypes change_type, ISet<String> changeset, ref Boolean typing_changed)
 {
     if (String.IsNullOrEmpty(file) || this.IsIgnored(file))
         return;
     Boolean logit;
     if (file.EndsWith(".d.ts")) {
         // Don't incur recompilation if new typing file appeared (it's probably empty anyway)
         if (0 != (change_type & WatcherChangeTypes.Created))
             logit = this.typing_files.Add(file);
         // Any change or deletion of typing file incurs full recompilation
         else {
             if (0 != (change_type & WatcherChangeTypes.Deleted))
                 this.typing_files.Remove(file);
             if (logit = changeset.Add(file))
                 typing_changed = true;
         }
         if (logit)
             Logger.Log("Typing {0}: {1}", change_type, file);
     } else {
         // Don't bother recompiling deleted source file
         if (0 != (change_type & WatcherChangeTypes.Deleted))
             logit = changeset.Remove(file);
         // Add source file to changeset for recompilation
         else
             logit = changeset.Add(file);
         if (logit)
             Logger.Log("Source {0}: {1}", change_type, file);
     }
 }
开发者ID:FirstWaveSoftware,项目名称:TsRecompiler,代码行数:29,代码来源:Program.cs


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