本文整理汇总了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;
}
示例2: RemoveAtTest
public void RemoveAtTest()
{
var set = new Set<int> { 1, 2, 3 };
set.RemoveAt(1);
set.ShouldEqual(1, 3);
}