package model.array;
import java.util.ArrayList;
import java.util.Collection;
import model.movie.Movie;
public class MovieArray extends ArrayList<Movie> {
private static final long serialVersionUID = 6826958774901473062L;
public MovieArray() {
super();
}
public MovieArray(Collection <? extends Movie> e) {
super(e);
}
@Override
public boolean add(Movie e) {
if (!contains(e))
return super.add(e);
return false;
}
public boolean remove(String uri) {
for (Movie m : this)
if (m.getUri().equals(uri))
return remove(m);
return false;
}
@Override
public boolean contains(Object o) {
if (o instanceof Movie) {
Movie movie = (Movie) o;
for (Movie m : this)
if (m.getUri().equals(movie.getUri()))
return true;
return false;
} else return super.contains(o);
}
}