500501502503504505506507508
@Override public PreferenceArray getPreferencesForItem(long itemID) throws TasteException { List<Preference> list = doGetPreferencesForItem(itemID); if (list.isEmpty()) { throw new NoSuchItemException(); } return new GenericItemPreferenceArray(list); }
175176177178179180181182183
if (useridx == null) { throw new NoSuchUserException(); } Integer itemidx = itemMap.get(itemID); if (itemidx == null) { throw new NoSuchItemException(); } return predictRating(useridx, itemidx); }
145146147148149150151152153
*/ @Override public Item getItem(Object id) throws NoSuchItemException { Item item = itemMap.get(id); if (item == null) { throw new NoSuchItemException(); } return item; }
656667686970717273
} public double[] getItemFeatures(long itemID) throws NoSuchItemException { Integer index = itemIDMapping.get(itemID); if (index == null) { throw new NoSuchItemException(itemID); } return itemFeatures[index]; }
858687888990919293
} public int itemIndex(long itemID) throws NoSuchItemException { Integer index = itemIDMapping.get(itemID); if (index == null) { throw new NoSuchItemException(itemID); } return index; }
248249250251252253254255256257
newPreferenceArray.set(prefsCounter++, anonymousPreference); } if (newPreferenceArray.length() == 0) { // No, didn't find it among the anonymous user prefs throw new NoSuchItemException(itemID); } return newPreferenceArray; }
233234235236237238239240241
@Override public PreferenceArray getPreferencesForItem(long itemID) throws NoSuchItemException { PreferenceArray prefs = preferenceForItems.get(itemID); if (prefs == null) { throw new NoSuchItemException(itemID); } return prefs; }
210211212213214215216217218219220
@Override public PreferenceArray getPreferencesForItem(long itemID) throws NoSuchItemException { FastIDSet userIDs = preferenceForItems.get(itemID); if (userIDs == null) { throw new NoSuchItemException(itemID); } PreferenceArray prefArray = new BooleanItemPreferenceArray(userIDs.size()); int i = 0; LongPrimitiveIterator it = userIDs.iterator(); while (it.hasNext()) {
511512513514515516517518519
@Override public PreferenceArray getPreferencesForItem(long itemID) throws TasteException { List<Preference> list = doGetPreferencesForItem(itemID); if (list.isEmpty()) { throw new NoSuchItemException(itemID); } return new GenericItemPreferenceArray(list); }
166167168169170171172173174
return cloneAndMergeInto(delegatePrefs, itemID, tempPrefs.getUserID(i), tempPrefs.getValue(i)); } } if (delegatePrefs == null) { // No, didn't find it among the anonymous user prefs throw new NoSuchItemException(itemID); } return delegatePrefs; }