Exemple #1
0
        public static IEnumerable <IEnumerable <int> > ChooseStringIndeces(int indecesToReplace, int stringStartLength)
        {
            var key = new IndexDictionaryKey(indecesToReplace, stringStartLength);

            if (IndexDictionary.ContainsKey(key))
            {
                return(IndexDictionary[key]);
            }

            var indexCombination = new List <string>();

            for (int i = 0; i < stringStartLength; i++)
            {
                indexCombination.Add(i.ToString());
            }

            var combinations = new List <string>();

            Choose("", indecesToReplace, indexCombination, combinations);

            var value = combinations.Select(i => i.Select(c => Int32.Parse(c.ToString())));

            IndexDictionary.Add(key, value);

            return(value);
        }
Exemple #2
0
        public static IEnumerable<IEnumerable<int>> ChooseStringIndeces(int indecesToReplace, int stringStartLength)
        {
            var key = new IndexDictionaryKey(indecesToReplace, stringStartLength);
            if (IndexDictionary.ContainsKey(key))
                return IndexDictionary[key];

            var indexCombination = new List<string>();
            for (int i = 0; i < stringStartLength; i++) {
                indexCombination.Add(i.ToString());
            }

            var combinations = new List<string>();
            Choose("", indecesToReplace, indexCombination, combinations);

            var value = combinations.Select(i => i.Select(c => Int32.Parse(c.ToString())));
            IndexDictionary.Add(key, value);

            return value;
        }