- bookNotFound
- bookNotAvailable
- bookTitleAlreadyExists
- bookISBNAlreadyExists
- bookAlreadyBought
- userAlreadyExists
- userNotFound
- constuctor
- borrowBook
- returnBook
- requestBook
- buyBook
- addUser
- findBookByTitle
- findBookByISBN
- findUserByName
Paramter is a call-back function, to be called after every request after 50th request.
this function is to be called when a user called $userName borrows a book called $Booktitle.
this function is to be called when a user returns a book.
This function is to be called when user requests a book (throws BookException::hasBeenRequestedFromThisUser).
this function is to be called when a new Book is bought to be added to the repository.
adds new user to to librarry
returns the book with corresponding title from the repo.
returns the book with corresponding ISBN from the repo.
returns the user with corresponding name from the repo.
- reachedMaxNumberOfBooks
- noSuchBook
creates a new user with User.name = name
add the borrowed book to the list of borrowed books of the user(a list of 10 books
remove the book from the list of borrowed books of the user
return name of the user
return user data as a string
- notAvailable
- notInRequest
- notBorrowed
- hasBeenRequestedFromThisUser
- available
- borrowed
- inRequest
- constructor
- request
- isAvailable
- borrow
- returnBook
- buyFromWaitingList
- toString
- getUser
- getTitle
- getISBN
- getAuthor
- getStatus
creates a new book with given parameters.
increases request counter if user hasn't already requested and returns the new val.
return true if book status is available (already bought and not borrowed).
change book status to borrowed and saved the borrowing user.
change book status to available.
change book status from requested to availalbe
return book data as a string
shows the book borrower or throws exception if not borrowed
returns book title
returns book isbn
returns book author
return book status of data Type Book::Status
P.S.
- callback functions is called once a book is requested. You can buy the book automatically in the function as in the example-3.
- You can use makefile to build the project writing the command "make".
- All actions happen in O(log(N)) time-complexity and O(N) place-complexity where N is the number of exisiting elemenst(users, books..).
- In user class books array has at most a constant of 10 elements that's why adding in linear time doesn't yield a bigger complexity.