private ITextSorter InstanceCreateTextSorter(eSortMode sortMode)
        {
            ITextSorter newInstance = null;

            switch (sortMode)
            {
            case eSortMode.AlphabeticAsc:
                newInstance = new AlphabeticAscendentSorter();
                break;

            case eSortMode.AlphabeticDesc:
                newInstance = new AlphabeticDescendentSorter();
                break;

            case eSortMode.LenghtAsc:
                newInstance = new WordLengthSorter();
                break;

            default:
                throw new NotImplementedException(TextConstants.SORTER_CRITERIA_NOTIMPLEMENTED);
            }

            return(newInstance);
        }
Exemple #2
0
        /// <summary>
        /// Method to sort a Text
        /// </summary>
        /// <param name="textToSort">piece of text</param>
        /// <param name="sortMode">sort criteria <see cref="eSortMode"/></param>
        /// <returns>Piece of text sorted</returns>
        public string Sort(string textToSort, eSortMode sortMode)
        {
            ITextSorter sorter = DIService.ContainerService.ResolveKeyed <ITextSorter>(sortMode);

            return(sorter.Sort(textToSort));
        }
 /// <summary>
 /// Method to sort a Text
 /// </summary>
 /// <param name="textToSort">piece of text</param>
 /// <param name="sorter">sorter of text</param>
 /// <returns>Piece of text sorted</returns>
 public string Sort(string textToSort, ITextSorter sorter)
 {
     return(sorter.Sort(textToSort));
 }