diff --git a/homeworks/02-goodreads/README.md b/homeworks/02-goodreads/README.md index f49523df..533d7da8 100644 --- a/homeworks/02-goodreads/README.md +++ b/homeworks/02-goodreads/README.md @@ -41,22 +41,22 @@ ```java package bg.sofia.uni.fmi.mjt.goodreads.recommender; - + import bg.sofia.uni.fmi.mjt.goodreads.book.Book; - -import java.util.Map; - + +import java.util.SortedMap; + public interface BookRecommenderAPI { /** * Searches for books that are similar to the provided one. * - * @param originBook the book we should calculate similarity with. - * @param maxN - the maximum number of entries returned - * @throws IllegalArgumentException if the originBook is null. - * @throws IllegalArgumentException if maxN is smaller than or equal to 0. - * @return a Map representing the top maxN closest books with their similarity to originBook - * ordered by their similarity score in descending order + * @param originBook the book we should calculate similarity with. + * @param maxN the maximum number of entries returned + * @return a SortedMap representing the top maxN closest books + * with their similarity to originBook ordered by their similarity score + * @throws IllegalArgumentException if the originBook is null. + * @throws IllegalArgumentException if maxN is smaller or equal to 0. */ SortedMap recommendBooks(Book originBook, int maxN); diff --git a/homeworks/02-goodreads/resources/src/bg/sofia/uni/fmi/mjt/goodreads/recommender/BookRecommender.java b/homeworks/02-goodreads/resources/src/bg/sofia/uni/fmi/mjt/goodreads/recommender/BookRecommender.java index b69acf57..6ff54662 100644 --- a/homeworks/02-goodreads/resources/src/bg/sofia/uni/fmi/mjt/goodreads/recommender/BookRecommender.java +++ b/homeworks/02-goodreads/resources/src/bg/sofia/uni/fmi/mjt/goodreads/recommender/BookRecommender.java @@ -3,17 +3,18 @@ import bg.sofia.uni.fmi.mjt.goodreads.book.Book; import bg.sofia.uni.fmi.mjt.goodreads.recommender.similaritycalculator.SimilarityCalculator; -import java.util.Map; import java.util.Set; +import java.util.SortedMap; public class BookRecommender implements BookRecommenderAPI { - public BookRecommender(Set initialBooks, SimilarityCalculator calculator) {} - + public BookRecommender(Set initialBooks, SimilarityCalculator calculator) { + throw new UnsupportedOperationException("Not yet implemented"); + } @Override - public Map recommendBooks(Book origin, int maxN) { + public SortedMap recommendBooks(Book origin, int maxN) { throw new UnsupportedOperationException("Not yet implemented"); } - + } diff --git a/homeworks/02-goodreads/resources/src/bg/sofia/uni/fmi/mjt/goodreads/recommender/BookRecommenderAPI.java b/homeworks/02-goodreads/resources/src/bg/sofia/uni/fmi/mjt/goodreads/recommender/BookRecommenderAPI.java index b30fb9b9..b9eaacb7 100644 --- a/homeworks/02-goodreads/resources/src/bg/sofia/uni/fmi/mjt/goodreads/recommender/BookRecommenderAPI.java +++ b/homeworks/02-goodreads/resources/src/bg/sofia/uni/fmi/mjt/goodreads/recommender/BookRecommenderAPI.java @@ -2,19 +2,20 @@ import bg.sofia.uni.fmi.mjt.goodreads.book.Book; -import java.util.Map; +import java.util.SortedMap; public interface BookRecommenderAPI { /** * Searches for books that are similar to the provided one. * - * @param originBook the book we should calculate similarity with. - * @param maxN - the maximum number of entries returned + * @param originBook the book we should calculate similarity with. + * @param maxN the maximum number of entries returned + * @return a SortedMap representing the top maxN closest books + * with their similarity to originBook ordered by their similarity score * @throws IllegalArgumentException if the originBook is null. * @throws IllegalArgumentException if maxN is smaller or equal to 0. - * @return a Map representing the top maxN closest books with their similarity to originBook ordered by their similarity score */ - Map recommendBooks(Book originBook, int maxN); - + SortedMap recommendBooks(Book originBook, int maxN); + }