public ISortStrategy CreateSort(SortAlgorithmEnum sortAlgorithm, SortTypeEnum sortType, IStepCounter stepCounter)
        {
            ISortType neededSortType = this.sortTypeFactory.CreateSortType(sortType);

            switch (sortAlgorithm)
            {
            case SortAlgorithmEnum.InsertionSort:
            {
                return(new InsertionSort(neededSortType, stepCounter));
            }

            case SortAlgorithmEnum.MergeSort:
            {
                return(new MergeSort(neededSortType, stepCounter));
            }

            case SortAlgorithmEnum.QuickSort:
            {
                return(new QuickSort(neededSortType, stepCounter));
            }

            case SortAlgorithmEnum.SelectionSort:
            {
                return(new SelectionSort(neededSortType, stepCounter));
            }

            default:
                return(null);
            }
        }
Example #2
0
        public void SortTypeFactory_CreateSortType_DescendingTypeValue_CreateDescendingTypeInstance()
        {
            var sortTypeFactory = new SortTypeFactory();

            ISortType sortType = sortTypeFactory.CreateSortType(SortTypeEnum.Descending);

            Assert.IsInstanceOfType(sortType, typeof(DescendingSortType));
        }
Example #3
0
 public void SetSorType(ISortType <T> type)
 {
     currentSortType = type;
 }
 partial void SortType_SetCondition(ref ISortField instance, ref ISortType setValue);
 protected override SortStrategyBase GetSortStrategy(ISortType sortType, IStepCounter stepCounter) => new QuickSort(sortType, stepCounter);
 protected abstract SortStrategyBase GetSortStrategy(ISortType sortType, IStepCounter stepCounter);
 public SelectionSort(ISortType sortType, IStepCounter stepCounter) : base(sortType, stepCounter)
 {
 }
Example #8
0
 public SortStrategyBase(ISortType sortType, IStepCounter stepCounter)
 {
     this.sortType    = sortType ?? throw new ArgumentNullException(nameof(sortType));
     this.stepCounter = stepCounter ?? throw new ArgumentNullException(nameof(stepCounter));
 }
Example #9
0
 public InsertionSort(ISortType sortType, IStepCounter stepCounter) : base(sortType, stepCounter)
 {
 }
 public QuickSort(ISortType sortType, IStepCounter stepCounter) : base(sortType, stepCounter)
 {
 }
 public MergeSort(ISortType sortType, IStepCounter stepCounter) : base(sortType, stepCounter)
 {
 }
Example #12
0
 /// <summary>
 ///     Inserts the specified index.
 /// </summary>
 /// <param name="index">The index.</param>
 /// <param name="name">The name.</param>
 /// <param name="sortType">Type of the sort.</param>
 /// <exception cref="DynCon.OSI.Core.Helpers.ToBeImplementedException"></exception>
 void ISortFieldList.Insert(Int32 index, String name, ISortType sortType)
 {
     throw new ToBeImplementedException();
 }
Example #13
0
 /// <summary>
 ///     Adds the specified name.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="sortType">Type of the sort.</param>
 /// <returns>Int32.</returns>
 /// <exception cref="DynCon.OSI.Core.Helpers.ToBeImplementedException"></exception>
 Int32 ISortFieldList.Add(String name, ISortType sortType)
 {
     throw new ToBeImplementedException();
 }
Example #14
0
 public static SortType GetInstance(ISortType src)
 {
     return(default(SortType));
 }