public bool IsEqual(ValidCombination other) { if (other.Combination.Count != Combination.Count) { return(false); } List <Entry> entriesCopy = new List <Entry>(Combination); foreach (Entry otherEntry in other.Combination) { bool found = false; foreach (Entry entry in entriesCopy) { if (entry.Group == otherEntry.Group && entry.Reversed == otherEntry.Reversed) { found = true; entriesCopy.Remove(entry); break; } } if (!found) { return(false); } } return(true); }
private bool Contains(ValidCombination combination) { foreach (ValidCombination existingCombination in m_validCombinations) { if (existingCombination.IsEqual(combination)) { return(true); } } return(false); }
private void CreateValidCombination() { Request[] newCombination = m_game.GetRequests(); ValidCombination validCombination = new ValidCombination(); foreach (Request request in newCombination) { foreach (RequestGroup group in m_requestGroups) { if (group.IsEqualRequest(request)) { validCombination.AddToCombination(group, request.ReverseTeams); break; } } } FoundCombinations.Add(validCombination); }