/// <summary> /// Performs an AND internal query, returning the result list of books. /// </summary> /// <returns>The result list of books</returns> public List <Book> ANDInternalQuery() { List <Book> requestedBooks = new List <Book>(); if (tags.Count > 0) { requestedBooks = booksManager.BooksRepository.GetAllBooksWithTag(tags[0]); for (int i = 1; i < tags.Count; i++) { requestedBooks = SetOperations <Book> .Intersection(requestedBooks, booksManager.BooksRepository.GetAllBooksWithTag(tags[i])); } } return(requestedBooks); }
/// <summary> /// Performs an AND internal query, returning the result list of books. /// </summary> /// <returns>The result list of books</returns> public List <Book> ANDInternalQuery() { List <Book> requestedBooks = new List <Book>(); if (yearsOfPublishing.Count > 0) { requestedBooks = booksManager.BooksRepository.GetAllBooksWithYearOfPublishing(yearsOfPublishing[0]); for (int i = 1; i < yearsOfPublishing.Count; i++) { requestedBooks = SetOperations <Book> .Intersection(requestedBooks, booksManager.BooksRepository.GetAllBooksWithYearOfPublishing(yearsOfPublishing[i])); } } return(requestedBooks); }
/// <summary> /// Performs an AND query on a list of lists of books, returning the resulting list of books. /// </summary> /// <param name="books">The list of lists of books</param> /// <returns>The resulting list of books</returns> public List <Book> PerformQuery(List <List <Book> > books) { List <Book> requestedBooks; if (books.Count == 0) { requestedBooks = new List <Book>(); } else { requestedBooks = books[0]; for (int i = 1; i < books.Count; i++) { requestedBooks = SetOperations <Book> .Intersection(requestedBooks, books[i]); } } return(requestedBooks); }