Ejemplo n.º 1
0
 public static IPostScoreCalculator CreatePostScoreCalculator(BestPostFinder.eScoreCalculationStyle i_CalculationStyle)
 {
     if (i_CalculationStyle.Equals(BestPostFinder.eScoreCalculationStyle.Comments))
     {
         return(new PostScoreCalculatorByComments());
     }
     else if (i_CalculationStyle.Equals(BestPostFinder.eScoreCalculationStyle.Formula))
     {
         return(new PostScoreCalculatorByFormula());
     }
     else
     {
         return(new PostScoreCalculatorByLikes());
     }
 }
Ejemplo n.º 2
0
        private int getPostScore(Post i_PostToCheck)
        {
            IPostScoreCalculator postCalculator;

            BestPostFinder.eScoreCalculationStyle scoreCalculationStyle = getScoreCalcStyle();
            postCalculator = PostScoreCalculatorCreator.CreatePostScoreCalculator(scoreCalculationStyle);
            int likes        = i_PostToCheck.LikedBy.Count;
            int comments     = i_PostToCheck.Comments.Count;
            int likeValue    = 1;
            int commentValue = 1;

            if (numericUpDownLikesValue.Enabled)
            {
                likeValue    = (int)numericUpDownLikesValue.Value;
                commentValue = (int)numericUpDownCommentsValue.Value;
            }

            return(postCalculator.GetScore(likes * likeValue, comments * commentValue));
        }