private NodeList UpdateNodeStates(NodeList nodes, NodeList backLoopNodes, NodeList candidates) { for (INodeCursor nc = nodes.Nodes(); nc.Ok; nc.Next()) { Node node = nc.Node; NodeState nodeState = GetNodeState(node); switch (nodeState) { case NodeState.BackLooping: backLoopNodes.AddFirst(node); break; case NodeState.BackLoopingCandidate: candidates.AddFirst(node); break; } nodeStates[node.Index] = nodeState; } return(candidates); }