public void GenerateNextCandidate() { Candidate lastCandidate = GetFirstOpenCandidate(); //GET NEW RANDOM CONNECTION POINTS FROM THE CURRENTLY OPEN ELEMENT List <ConnPointCandidate> connPointCandidate = lastCandidate.GetAllOpenConnPoints(random); int connPointCandidateCount = connPointCandidate.Count; int connPointCandidateIndex = 0; Candidate newCandidate = null; do { ConnPointCandidate lastConnPointCandidate = connPointCandidate[connPointCandidateIndex++]; newCandidate = ConnectNewCandidateToConnPoint(lastConnPointCandidate); } while (newCandidate == null && connPointCandidateIndex < connPointCandidateCount); if (newCandidate == null) { throw new System.Exception("CandidateManager::No Candidate fits."); } }