Ejemplo n.º 1
0
        public void StartSorting()
        {
            ISortingAlogrithm <T> sortingAlgorithm = SortingAlgorithmsFactory <T> .CreateSortingInstnace(_sortingListener.AlgorithmType);

            sortingAlgorithm.SortItemsAscending(_sortingListener.ItemsToBeSorted);

            _sortingListener.ItemsSortedHandler();
        }
        public static ISortingAlogrithm <T> CreateSortingInstnace(SortingAgorithmType sortingAgorithmType)
        {
            ISortingAlogrithm <T> sortingAlgorithm = null;

            switch (sortingAgorithmType)
            {
            case SortingAgorithmType.InsertionSort:
                sortingAlgorithm = new InsertionSort <T>();
                break;
            }

            return(sortingAlgorithm);
        }