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


C# Set.RemoveAt方法代码示例

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


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

示例1: MinimizeDFA

        /*** Create a minimized version of the DFA (called DFAmin) ***/
        private AutomataState MinimizeDFA(AutomataState Szero_DFA)
        {
            // 1) partition the DFS states (filling 2nd and 3rd arguments)
            Set transSymbols = new Set();
            Set DFAstates = new Set();
            FillStatesAndSymbols(DFAstates, transSymbols, Szero_DFA);
            ArrayList arr = createDFASets(DFAstates, transSymbols);

            // 2) through all the groups and select a pivot for each group.
            AutomataState stateStartReducedDfa = null;
            foreach (object objGroup in arr)
            {
                Set setGroup = (Set)objGroup;

                // check final states SzeroDFA in the group
                bool finalStInGroup = ExistFinalStateInSet(setGroup);
                bool startDFAinGroup = setGroup.Contains(Szero_DFA);

                AutomataState pivotState = (AutomataState)setGroup[0];

                if (startDFAinGroup)
                {
                    stateStartReducedDfa = pivotState;
                }

                if (finalStInGroup)
                {
                    pivotState.IsFinalState = true;
                }

                // if there are only once element, continue loop
                if (setGroup.NumOfElement == 1)
                {
                    continue;
                }

                // 3) [innerLoop] remove the pivot from its group and replace all the references of the remaining member of the group
                setGroup.removeElFromSet(pivotState);

                // state to be replaced with the group of pivot
                AutomataState stateToBeReplaced = null;

                int numOfReplace = 0;
                foreach (object objStateToReplaced in setGroup)
                {
                    stateToBeReplaced = (AutomataState)objStateToReplaced;

                    DFAstates.removeElFromSet(stateToBeReplaced);

                    foreach (object objState in DFAstates)
                    {
                        numOfReplace = numOfReplace + ((AutomataState)objState).replaceEndstateForTransitions(stateToBeReplaced, pivotState);
                    }
                }
            }

            //  4) finally can remove all "close states"
            for (int n = 0; n < DFAstates.Count; n++)
            {
                AutomataState state = (AutomataState)DFAstates[n];
                if (state.isAClosedState())
                {
                    DFAstates.RemoveAt(n);
                    continue;
                }
            }

            return stateStartReducedDfa;
        }
开发者ID:PeppeMir,项目名称:RegEx-Parser-Interpreter-Compiler,代码行数:70,代码来源:RExpr.cs

示例2: RemoveAtTest

 public void RemoveAtTest()
 {
     var set = new Set<int> { 1, 2, 3 };
     set.RemoveAt(1);
     set.ShouldEqual(1, 3);
 }
开发者ID:drbatty,项目名称:maths-core,代码行数:6,代码来源:SetTests.cs


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