Kaynağa Gözat

Updated documentations to include all classes available

master
BinHong Lee 7 yıl önce
ebeveyn
işleme
2d9c778a24
2 değiştirilmiş dosya ile 51 ekleme ve 0 silme
  1. +2
    -0
      README.md
  2. +49
    -0
      docs/index.md

+ 2
- 0
README.md Dosyayı Görüntüle

@@ -2,6 +2,8 @@

##### NOTE: Still not working as intended.

Documentations can be found [here](https://binhonglee.github.io/LibrarySystem/).

---

## Dependencies


+ 49
- 0
docs/index.md Dosyayı Görüntüle

@@ -1,7 +1,21 @@
# Documentations

- [Main](#main)
- [Book](#book)
- [Book Factory](#book-factory)
- [User](#user)
- [User Factory](#user-factoru)

# Main

## Functions

| Return | Method | Description |
|:-------|:-------|:------------|
| boolean | borrowBook(User user, Book book) | Return if the borrow of the book on both `BookFactory` and `UserFactory` is successful
| boolean | returnBook(User user, Book book) | Return if the return of the book on both `BookFactory` and `UserFactory` is successful
| int[] | calDueDate(int days) | Calculate the due date from the current date according to user's permission
| int[] | currentDay() | Returns the current date in an array form |

# Book

@@ -40,3 +54,38 @@
| Book | getBook(int index) | Returns the book of the given index if it exist, else throw null pointer exception |
| Book | getBook(String title) | Returns the book of the given title if it exist, else throw null pointer exception |
| void | update(Book newbook) | Replaces the existing book of the same id with this new one |

# User

## Constructors

| Method | Description |
|:-------|:------------|
| User(String name, int id, int limit) | Create a new User with given name, id and limit |

## Functions
| Return | Method | Description |
|:-------|:-------|:------------|
| String | getName() | Returns the name of the user |
| int | getId() | Returns id of the user |
| void | setName() | Set the name of the user |
| boolean | status() | Check if the user reached the limit of amount of books the user can borrow |
| List<Integer> | bookStatus() | Return a list consisting of book ids for all the books rented by the user |
| boolean | borrowNewBook(int id) | Check if the user status if true then add the id to the list of the books borrowed by the user |
| boolean | returnBook(int id) | Check if the book is borrowed by the user then remove it from the list |

# User Factory

## Constructors

| Method | Description |
|:-------|:------------|
| UserFactory() | Creates a new empty factory |

## Functions
| Return | Method | Description |
|:-------|:-------|:------------|
| User | newUser(String name, int limit) | Creates a new user and returns the created user |
| User | getUser(String name) | Gets the user with the given name from the factory |
| User | getUser(int index) | Gets the user with the given id from the factory |
| void | update(User oldUser, User newUser) | Update by replacing the existing user with the new one |

Yükleniyor…
İptal
Kaydet