protected override FastIDSet doGetCandidateItems(long[] preferredItemIDs, DataModel dataModel) { IEnumerator <long> enumerator = ((IEnumerable <long>)preferredItemIDs).GetEnumerator(); if (preferredItemIDs.Length > this.maxItems) { double samplingRate = ((double)this.maxItems) / ((double)preferredItemIDs.Length); log.info("preferredItemIDs.Length {0}, samplingRate {1}", new object[] { preferredItemIDs.Length, samplingRate }); enumerator = new SamplingLongPrimitiveIterator(enumerator, samplingRate); } FastIDSet possibleItemIDs = new FastIDSet(); while (enumerator.MoveNext()) { long current = enumerator.Current; PreferenceArray array = dataModel.getPreferencesForItem(current); int num3 = array.length(); if (num3 > this.maxUsersPerItem) { FixedSizeSamplingIterator <Preference> iterator = new FixedSizeSamplingIterator <Preference>(this.maxUsersPerItem, array.GetEnumerator()); while (iterator.MoveNext()) { this.addSomeOf(possibleItemIDs, dataModel.getItemIDsFromUser(iterator.Current.getUserID())); } } else { for (int i = 0; i < num3; i++) { this.addSomeOf(possibleItemIDs, dataModel.getItemIDsFromUser(array.getUserID(i))); } } } possibleItemIDs.removeAll(preferredItemIDs); return(possibleItemIDs); }