The GatorLibrary class represents a library system.This class provides functionality to manage books in the library, including inserting, borrowing, returning, and deleting books. It also provides functions to print book information, count color flips in the red-black tree, and find the closest book to a given book ID.
More...
#include <gator_library.hpp>
|
void | PrintBook (int bookID) |
| Display the book details.
|
|
void | PrintBooks (int bookID1, int bookID2) |
| Display the book details for all books in the range.
|
|
void | InsertBook (int bookID, string bookName, string authorName, string availabilityStatus) |
| Insert a new book into the library.
|
|
bool | BorrowBook (int patronID, int bookID, int patronPriority) |
| Borrow a book from the library.
|
|
void | ReturnBook (int patronID, int bookID) |
| Return a book to the library.
|
|
void | DeleteBook (int bookID) |
| Delete a book from the library.
|
|
void | ColorFlipCount () |
| Display the number of color flips in the red black tree.
|
|
void | FindClosestBook (int targetId) |
| Find the book Id closest to the targetId.
|
|
The GatorLibrary class represents a library system.
This class provides functionality to manage books in the library, including inserting, borrowing, returning, and deleting books. It also provides functions to print book information, count color flips in the red-black tree, and find the closest book to a given book ID.
◆ BorrowBook()
bool GatorLibrary::BorrowBook |
( |
int |
patronID, |
|
|
int |
bookID, |
|
|
int |
patronPriority |
|
) |
| |
Borrow a book from the library.
- Parameters
-
patronID | Integer. |
bookID | Integer. |
patronPriority | Integer. |
- Returns
- True if the book is borrowed, false otherwise.
If the book is not available, add the reservation to the book's reservation heap. Reservation heap is a priority queue of reservations.
◆ ColorFlipCount()
void GatorLibrary::ColorFlipCount |
( |
| ) |
|
Display the number of color flips in the red black tree.
Color flip count is the number of times the color of a node is flipped from red to black or vice versa.
◆ DeleteBook()
void GatorLibrary::DeleteBook |
( |
int |
bookID | ) |
|
Delete a book from the library.
- Parameters
-
If the book is borrowed, the reservation is cancelled for all the patrons.
◆ FindClosestBook()
void GatorLibrary::FindClosestBook |
( |
int |
targetId | ) |
|
Find the book Id closest to the targetId.
- Parameters
-
◆ InsertBook()
void GatorLibrary::InsertBook |
( |
int |
bookID, |
|
|
string |
bookName, |
|
|
string |
authorName, |
|
|
string |
availabilityStatus |
|
) |
| |
Insert a new book into the library.
- Parameters
-
bookID | String. |
bookName | String. |
authorName | String. |
availabilityStatus | String. |
◆ PrintBook()
void GatorLibrary::PrintBook |
( |
int |
bookID | ) |
|
Display the book details.
- Parameters
-
◆ PrintBooks()
void GatorLibrary::PrintBooks |
( |
int |
bookID1, |
|
|
int |
bookID2 |
|
) |
| |
Display the book details for all books in the range.
- Parameters
-
◆ ReturnBook()
void GatorLibrary::ReturnBook |
( |
int |
patronID, |
|
|
int |
bookID |
|
) |
| |
Return a book to the library.
- Parameters
-
patronID | Integer. |
bookID | Integer. |
If the book is reserved, the book is borrowed by the next patron in the reservation heap.
◆ rbtBooks
The documentation for this class was generated from the following files: