private void ProcessSymbolTransitions(DottedRuleSet frame) { var pool = SharedPools.Default <Dictionary <ISymbol, SortedSet <IDottedRule> > >(); var transitions = pool.AllocateAndClear(); for (int i = 0; i < frame.Data.Count; i++) { var nfaState = frame.Data[i]; if (IsComplete(nfaState)) { continue; } var postDotSymbol = GetPostDotSymbol(nfaState); var targetStates = transitions.AddOrGetExisting(postDotSymbol); var nextRule = GetPreComputedState(nfaState.Production, nfaState.Position + 1); targetStates.Add(nextRule); } foreach (var symbol in transitions.Keys) { var confirmedStates = GetConfirmedStates(transitions[symbol]); var valueDottedRuleSet = AddNewOrGetExistingDottedRuleSet(confirmedStates); frame.AddTransistion(symbol, valueDottedRuleSet); } pool.ClearAndFree(transitions); }