public RatingResult ComputeResult(IRatingAlgorithm algorithm, int numberOfReviewsToUse) { var filteredReviews = _restaurant.Reviews.Take(numberOfReviewsToUse); return(algorithm.Compute(filteredReviews.ToList())); }
public RatingResult ComputeResult(IRatingAlgorithm algorithm, int numberOfReviewsToUse) { var filteredReviews = _restaurant.Reviews.Take(numberOfReviewsToUse); return algorithm.Compute(filteredReviews.ToList()); }
public static void Rank(RatingScope scope, IRatingTarget targetScore, RatingMethod method) { //int t1 = Environment.TickCount; List <Student> students = scope.GetContainTargetList(targetScore); //按成績高低排序。 students.Sort(new ScoreComparer(targetScore)); //實際有包含成績的人數。 int actualBase = students.Count; //所有被排名的人數。 int baseCount = scope.Count; //名次決定演算法。 IRatingAlgorithm placeDecision = GetAlgorithm(method); foreach (Student eachStudent in students) { //決定名次 int place = placeDecision.NextPlace(targetScore.GetScore(eachStudent)); //寫入名次資訊。 targetScore.SetPlace(eachStudent, new ResultPlace(scope, targetScore, baseCount, actualBase, place)); } //string msg = "排名時間:{0} 範圍名稱:{1} 成績名稱:{2}"; //Console.WriteLine(msg, Environment.TickCount - t1, scope.Name, targetScore.Name); }
public RatingResult ComputeRating(IRatingAlgorithm ratingAlgorithm, int numberOfReviews) { var reviews = _restaurant .Reviews .Take(numberOfReviews) .ToList(); return(ratingAlgorithm.Compute(reviews)); }
public RateResult ComputeRate( IRatingAlgorithm algorithm, int numerToUse) { return algorithm.Compute(_ratable.Reviews.Take(numerToUse).ToList()); }
public int ComputeRating(IRatingAlgorithm ratingAlgorithm, int numberOfReviewsTouse) { var restaurantToRate = restaurant.Reviews.Take(numberOfReviewsTouse).ToList(); return(ratingAlgorithm.Compute(restaurantToRate)); }
public RatingResult ComputeResult(IRatingAlgorithm algorithm, int numberOfReviews) { return(algorithm.Compute(_Restaurant.Reviews.Take(numberOfReviews).ToList())); }