Beispiel #1
0
        /// <summary>
        /// Find the picture with the minimum likes
        /// </summary>
        /// <param name="i_MostLikeablePhotos">Most likeable picture</param>
        /// <param name="i_Compare"></param>
        /// <returns>The photo with the minimum likes</returns>
        private Photo findMinInTopLikable(List <Photo> i_MostLikeablePhotos, ICompare i_Compare)
        {
            Photo minPhoto = i_MostLikeablePhotos[0];

            foreach (Photo photo in i_MostLikeablePhotos)
            {
                if (i_Compare.Decide(minPhoto, photo))
                {
                    minPhoto = photo;
                }
            }

            return(minPhoto);
        }
Beispiel #2
0
        /// <summary>
        /// find most likeable photos
        /// </summary>
        /// <param name="i_NumberOfPhotosToShow">number of photos to show</param>
        /// <param name="i_ListOfPhotos">List of photos</param>
        /// <param name="i_Compare">Compare</param>
        /// <returns>Listed Number of photos to show</returns>
        public List <Photo> FindComparedPhotos(int i_NumberOfPhotosToShow, List <Photo> i_ListOfPhotos, ICompare i_Compare)
        {
            List <Photo> topLikeablePhotos = new List <Photo>(i_NumberOfPhotosToShow);

            Photo minPhoto = new Photo();

            foreach (Photo photo in i_ListOfPhotos)
            {
                if (topLikeablePhotos.Count != topLikeablePhotos.Capacity)
                {
                    topLikeablePhotos.Add(photo);
                    minPhoto = findMinInTopLikable(topLikeablePhotos, i_Compare);
                }
                else
                {
                    if (i_Compare.Decide(photo, minPhoto))
                    {
                        addPhotoToList(photo, ref minPhoto, topLikeablePhotos, i_Compare);
                    }
                }
            }

            return(topLikeablePhotos);
        }
Beispiel #3
0
        /// <summary>
        /// Find the picture with the minimum likes
        /// </summary>
        /// <param name="i_MostLikeablePhotos">Most likeable picture</param>
        /// <param name="i_Compare"></param>
        /// <returns>The photo with the minimum likes</returns>
        private Photo findMinInTopLikable(List<Photo> i_MostLikeablePhotos, ICompare i_Compare)
        {
            Photo minPhoto = i_MostLikeablePhotos[0];

            foreach (Photo photo in i_MostLikeablePhotos)
            {
                if (i_Compare.Decide(minPhoto, photo))
                {
                    minPhoto = photo;
                }
            }

            return minPhoto;
        }
Beispiel #4
0
        /// <summary>
        /// find most likeable photos
        /// </summary>
        /// <param name="i_NumberOfPhotosToShow">number of photos to show</param>
        /// <param name="i_ListOfPhotos">List of photos</param>
        /// <param name="i_Compare">Compare</param>
        /// <returns>Listed Number of photos to show</returns>
        public List<Photo> FindComparedPhotos(int i_NumberOfPhotosToShow, List<Photo> i_ListOfPhotos, ICompare i_Compare)
        {
            List<Photo> topLikeablePhotos = new List<Photo>(i_NumberOfPhotosToShow);

            Photo minPhoto = new Photo();

            foreach (Photo photo in i_ListOfPhotos)
            {
                if (topLikeablePhotos.Count != topLikeablePhotos.Capacity)
                {
                    topLikeablePhotos.Add(photo);
                    minPhoto = findMinInTopLikable(topLikeablePhotos, i_Compare);
                }
                else
                {
                    if (i_Compare.Decide(photo, minPhoto))
                    {
                        addPhotoToList(photo, ref minPhoto, topLikeablePhotos, i_Compare);
                    }
                }
            }

            return topLikeablePhotos;
        }