AddressMatch.MatchMachine.FilterState C# (CSharp) Method

FilterState() private method

private FilterState ( State correntState, State preState ) : State
correntState State
preState State
return State
        private State FilterState(State correntState,State preState)
        {
            correntState.NodeList.RemoveAll(delegate(GraphNode node)
            {
                return !LocalMatchRule(preState, node);
            });
            if (correntState.NodeList.Count() == 0)
            {
                correntState.MaxStateLEVEL = LEVEL.Uncertainty;
                correntState.MinStateLEVEL = LEVEL.Uncertainty;
                correntState.NodeCount = 0;
                correntState.NodeList = null;
            }
            else
            {
                //--------------------TODO   not effective
                LEVEL min = correntState.NodeList.First().NodeLEVEL;
                LEVEL max = correntState.NodeList.First().NodeLEVEL;

                foreach (GraphNode node in correntState.NodeList)
                {
                    min = min < node.NodeLEVEL ? min : node.NodeLEVEL;
                    max = max > node.NodeLEVEL ? max : node.NodeLEVEL;
                }

                correntState.MaxStateLEVEL = max;
                correntState.MinStateLEVEL = min;
                correntState.NodeCount = correntState.NodeList.Count();

            }
            return correntState;
        }