Ejemplo n.º 1
0
        private static IReadOnlyList <Suggestion> GetIndexesCombinations(IEnumerable <Suggestion> suggestions, IReadOnlyList <Connector> connectors)
        {
            var result = new List <Suggestion>();

            foreach (var suggestion in suggestions)
            {
                for (var indexInSuggestion = 0; indexInSuggestion < suggestion.List.Count; indexInSuggestion++)
                {
                    var indexInConnectors     = suggestion.List[indexInSuggestion];
                    var lastIndexInConnectors = connectors.Count;

                    if (indexInSuggestion + 1 < suggestion.List.Count)
                    {
                        lastIndexInConnectors = suggestion.List[indexInSuggestion + 1];
                    }

                    var i = indexInConnectors + 1;

                    while (i < lastIndexInConnectors && connectors[i].MaxCurrentInAmps == connectors[indexInConnectors].MaxCurrentInAmps)
                    {
                        var suggestionCombination = new Suggestion(suggestion.List);
                        suggestionCombination.ReplaceIndexValue(indexInSuggestion, i);
                        result.Add(suggestionCombination);
                        i++;
                    }
                }
            }

            return(result);
        }