package logic;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;

import data.Actor;
import data.DataBase;
import data.Movie;
import data.comperators.MovieComparatorRating;

public class Recomendations {

	private DataBase db = DataBase.getInstance();
	
	public ArrayList<Movie> withActor(Actor a , int limit){
		if(limit > 200)
			limit = 200;
		ArrayList<Movie> out = new ArrayList<>();
		for(Movie m : db.getMovies()) {
			if(m.getActors().contains(a)) {
				out.add(m);
				if(out.size() >= limit)
					return out;
			}
		}
		Collections.sort(out, new MovieComparatorRating());
		return out;
	}
}
