|
@@ -16,6 +16,7 @@ import data.comperators.MovieComparatorRating;
|
|
|
public class Recomendations {
|
|
public class Recomendations {
|
|
|
|
|
|
|
|
private DataBase db = DataBase.getInstance();
|
|
private DataBase db = DataBase.getInstance();
|
|
|
|
|
+ private Movie bla;
|
|
|
|
|
|
|
|
public ArrayList<Movie> withActor(Actor a , int limit){
|
|
public ArrayList<Movie> withActor(Actor a , int limit){
|
|
|
if(limit > 200)
|
|
if(limit > 200)
|
|
@@ -64,8 +65,26 @@ public class Recomendations {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ ArrayList<Movie> temp = new ArrayList<>();
|
|
|
|
|
+ while(out.size() != 0) {
|
|
|
|
|
+ out.forEach((k,v) -> {
|
|
|
|
|
+ int max = 0;
|
|
|
|
|
+ if(v > max) {
|
|
|
|
|
+ max = v;
|
|
|
|
|
+ bla = k;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ out.remove(bla);
|
|
|
|
|
+ temp.add(bla);
|
|
|
|
|
+ }
|
|
|
|
|
+ Collections.sort(temp, new MovieComparatorRating());
|
|
|
|
|
+ ArrayList<Movie> ret = new ArrayList<>();
|
|
|
|
|
+ for(int i = 0;i < limit ;i++ ) {
|
|
|
|
|
+ ret.add(temp.get(i));
|
|
|
|
|
+ }
|
|
|
|
|
+ return ret;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
|
|
|
public ArrayList<Movie> withGenre(String genre, int limit){
|
|
public ArrayList<Movie> withGenre(String genre, int limit){
|
|
|
if(limit > 200)
|
|
if(limit > 200)
|