Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Book and BookShelf models #45

Merged
merged 9 commits into from
Mar 8, 2018

Conversation

takuyakanbr
Copy link

  • Add Book and its components
  • Add UniqueBookList
  • Add BookShelf
  • Add unit tests for new classes

@takuyakanbr takuyakanbr added the status.in_progress Currently being worked on label Mar 8, 2018
@takuyakanbr takuyakanbr added status.completed Ready to be reviewed and removed status.in_progress Currently being worked on labels Mar 8, 2018
}
}

//// person-level operations
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

book


this.bookShelf = new BookShelf(bookShelf);
this.filteredBooks = new FilteredList<>(this.bookShelf.getBookList());
this.addressBook = new AddressBook();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed for now to keep tests from failing

@Override
public void deleteBook(Book target) throws BookNotFoundException {
bookShelf.removeBook(target);
indicateAddressBookChanged();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indicateBookShelfChanged

public void addBook(Book book) throws DuplicateBookException {
bookShelf.addBook(book);
updateFilteredBookList(PREDICATE_SHOW_ALL_BOOKS);
indicateAddressBookChanged();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indicateBookShelfChanged

requireAllNonNull(target, editedBook);

bookShelf.updateBook(target, editedBook);
indicateAddressBookChanged();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indicateBookShelfChanged

}

@Override
public String toString() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean this looks legit? o_o

/**
* Constructs a {@code Category}.
*
* @param category A valid category.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does valid even mean here

/**
* Constructs a {@code Description}.
*
* @param description A valid description.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you must love the word valid a lot

*
* Supports a minimal set of list operations.
*/
public class UniqueBookList implements Iterable<Book> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not extending UniqueList?

this.internalList.setAll(replacement.internalList);
}

public void setBooks(List<Book> books) throws DuplicateBookException {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can replace with Collection

@qiu-siqi qiu-siqi merged commit 71adc4d into CS2103JAN2018-F14-B4:master Mar 8, 2018
@takuyakanbr takuyakanbr deleted the add-models branch March 8, 2018 15:04
@takuyakanbr takuyakanbr added status.accepted Accepted and removed status.completed Ready to be reviewed labels Mar 8, 2018
@takuyakanbr takuyakanbr added the type.task Something that the developer can do label Mar 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status.accepted Accepted type.task Something that the developer can do
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants