@Test public void testStdFree() { int maxLength = Integer.MAX_VALUE; List<Tuple2od<String>> result = recommender.getRecommendation("0", maxLength).getItems(); List<Tuple2od<String>> expected = Arrays.asList( tuple("0", 6.0), tuple("1", 5.0), tuple("2", 4.0), tuple("3", 3.0), tuple("4", 2.0), tuple("5", 1.0) ); assertEquals(expected, result); }
@Override public Recommendation<U, I> getRecommendation(U u, int maxLength) { FastRecommendation rec = getRecommendation(user2uidx(u), maxLength); return new Recommendation<>(uidx2user(rec.getUidx()), rec.getIidxs().stream() .map(this::iidx2item) .collect(toList())); }
AbstractFastRecommender extends AbstractRecommender<U, I> implements FastRecommender<U, I> { @Override public Recommendation<U, I> getRecommendation(U u, int maxLength) { FastRecommendation rec = getRecommendation(user2uidx(u), maxLength); return new Recommendation<>(uidx2user(rec.getUidx()), rec.getIidxs().stream() .map(this::iidx2item) .collect(toList())); } }
AbstractFastRecommender extends AbstractRecommender<U, I> implements FastRecommender<U, I> { @Override public Recommendation<U, I> getRecommendation(U u, int maxLength) { FastRecommendation rec = getRecommendation(user2uidx(u), maxLength); return new Recommendation<>(uidx2user(rec.getUidx()), rec.getIidxs().stream() .map(this::iidx2item) .collect(toList())); } AbstractFastRecommender(FastUserIndex<U> uIndex, FastItemIndex<I> iIndex); }
AbstractFastRecommender extends AbstractRecommender<U, I> implements FastRecommender<U, I> { @Override public Recommendation<U, I> getRecommendation(U u, int maxLength) { FastRecommendation rec = getRecommendation(user2uidx(u), maxLength); return new Recommendation<>(uidx2user(rec.getUidx()), rec.getIidxs().stream() .map(this::iidx2item) .collect(toList())); } AbstractFastRecommender(FastUserIndex<U> uIndex, FastItemIndex<I> iIndex); @Override int numUsers(); @Override int user2uidx(U u); @Override U uidx2user(int uidx); @Override int numItems(); @Override int item2iidx(I i); @Override I iidx2item(int iidx); @Override Recommendation<U, I> getRecommendation(U u, int maxLength); @Override FastRecommendation getRecommendation(int uidx); @Override FastRecommendation getRecommendation(int uidx, int maxLength); @Override Recommendation<U, I> getRecommendation(U u, int maxLength, Predicate<I> filter); @Override FastRecommendation getRecommendation(int uidx, IntPredicate filter); @Override abstract FastRecommendation getRecommendation(int uidx, int maxLength, IntPredicate filter); @Override Recommendation<U, I> getRecommendation(U u, Stream<I> candidates); @Override FastRecommendation getRecommendation(int uidx, IntStream candidates); }
AbstractFastRecommender extends AbstractRecommender<U, I> implements FastRecommender<U, I> { @Override public Recommendation<U, I> getRecommendation(U u, int maxLength) { FastRecommendation rec = getRecommendation(user2uidx(u), maxLength); return new Recommendation<>(uidx2user(rec.getUidx()), rec.getIidxs().stream() .map(this::iidx2item) .collect(toList())); } AbstractFastRecommender(FastUserIndex<U> uIndex, FastItemIndex<I> iIndex); @Override int numUsers(); @Override int user2uidx(U u); @Override U uidx2user(int uidx); @Override int numItems(); @Override int item2iidx(I i); @Override I iidx2item(int iidx); @Override Recommendation<U, I> getRecommendation(U u, int maxLength); @Override FastRecommendation getRecommendation(int uidx); @Override FastRecommendation getRecommendation(int uidx, int maxLength); @Override Recommendation<U, I> getRecommendation(U u, int maxLength, Predicate<I> filter); @Override FastRecommendation getRecommendation(int uidx, IntPredicate filter); @Override abstract FastRecommendation getRecommendation(int uidx, int maxLength, IntPredicate filter); @Override Recommendation<U, I> getRecommendation(U u, Stream<I> candidates); @Override FastRecommendation getRecommendation(int uidx, IntStream candidates);  }