public class MovieLibrary
extends java.lang.Object
Constructor | Description |
---|---|
MovieLibrary() |
A constructor that allocates memory for the instance/member variable
|
Modifier and Type | Method | Description |
---|---|---|
void |
addMovie(Movie movie) |
Adds a movie to the instance/member variable
|
java.util.List<Movie> |
filterMoviesByRating(int lowestRating,
int highestRating,
Rating.ReviewType reviewer) |
A method that creates a new list of movies in the range of the lowestRating and highestRating (inclusive).
|
java.util.List<Movie> |
filterMoviesByRating(int lowestRating,
Rating.ReviewType reviewer) |
Similar to
filterMoviesByRating(int, int, Rating.ReviewType) but only
returns movies that have a rating greater than or equal to the lowestRating. |
static java.lang.String |
formatKeyWords(java.util.List<KeyWord> keywords) |
A Helper method to format KeyWords, 5 per line.
|
static java.lang.String |
formatMovies(java.util.List<Movie> movies) |
Takes a list of movies and returns a String with each movies toString separated by a newline.
|
static java.lang.String |
getDescriptions(java.util.List<Movie> movies) |
A movie description is defined as:
Title (one line)
genres (one line)
keywords (5 per line, one or more lines)
Use the provided helper method formatKeyWords to format the keywords.
|
java.util.List<Movie> |
getMovies() |
Getter method for the corresponding member variable
|
static void |
main(java.lang.String[] args) |
public MovieLibrary()
public void addMovie(Movie movie)
movie
- the Movie to add to the MovieLibrary objectpublic java.util.List<Movie> getMovies()
public java.util.List<Movie> filterMoviesByRating(int lowestRating, int highestRating, Rating.ReviewType reviewer)
Rating.ReviewType
then whether or not the movie is within the range of lowestRating
and highestRating, inclusive. Rating.ReviewType
can either be CRITIC, AUDIENCE, or BOTH.lowestRating
- the lowest rating a movie can behighestRating
- the highest rating a movie can bereviewer
- can be CRITIC, AUDIENCE, or BOTHpublic java.util.List<Movie> filterMoviesByRating(int lowestRating, Rating.ReviewType reviewer)
filterMoviesByRating(int, int, Rating.ReviewType)
but only
returns movies that have a rating greater than or equal to the lowestRating.
Consider calling filterMoviesByRating(int, int, Rating.ReviewType)
so that you don't repeat work.lowestRating
- the lowest rating a movie can bereviewer
- true if filtering by critic reviews, false if audiencepublic static java.lang.String getDescriptions(java.util.List<Movie> movies)
Late Night Shopping
Comedy
less than 300 ratings
Futurama: The Beast with a Billion Backs
Animation Comedy Sci-Fi
movie to see
Dagon
Fantasy Horror Mystery Thriller
monsters, hp lovecraft, lovecraftian mythology
movies
- a list of moviespublic static java.lang.String formatMovies(java.util.List<Movie> movies)
movies
- The movies to convertpublic static java.lang.String formatKeyWords(java.util.List<KeyWord> keywords)
keywords
- a list of keywords describing a moviepublic static void main(java.lang.String[] args) throws java.io.FileNotFoundException
java.io.FileNotFoundException