Beispiel #1
0
        public List <string> calculate()
        {
            var watch = System.Diagnostics.Stopwatch.StartNew();

            //collect all operand permutations
            List <List <string> > operandLists = getAllOperandPermutations();

            //reorder operands for maximum efficiency
            List <List <string> > orderedOperandLists = reorderOperandPermutations(operandLists);

            //create list of threads to deal with operand permutations
            List <Thread> threadList = createThreadList(orderedOperandLists);

            //start each thread
            foreach (Thread aThread in threadList)
            {
                aThread.Start();
            }

            //wait for each thread to finish
            foreach (Thread aThread in threadList)
            {
                aThread.Join();
            }
            var elapsedMs = watch.ElapsedMilliseconds;

            return(infixSolutions.ToList <string>());
        }
 public ICollection <string> findAllWords(string inputLetters)
 {
     letters = inputLetters.ToList().AsReadOnly();
     startThreads();
     return(wordsFound.ToList());
 }
 /// <summary>
 /// Returns the failure exceptions collection.
 /// </summary>
 /// <returns></returns>
 public ICollection <Exception> GetFailureExceptions()
 {
     return(new ReadOnlyCollection <Exception>(_failureExceptions.ToList()));
 }