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