public class User
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.List<java.lang.Integer> |
books |
private int |
id |
private int |
limit |
private java.lang.String |
name |
Constructor and Description |
---|
User(java.lang.String name,
int id,
int limit)
Creates a new User with name, id and limit (usually used to add new User)
|
User(java.lang.String name,
int id,
int limit,
java.util.ArrayList<java.lang.Integer> books)
Creates a new User with name, id, limit and books (usually used to initialize from database)
|
Modifier and Type | Method and Description |
---|---|
int[] |
bookStatus()
Get Book ids of the books
|
(package private) boolean |
borrowNewBook(int id)
User borrows a Book
|
int |
getId()
Gets id of this User
|
int |
getLimit()
Gets limit of Book this User can borrow
|
java.lang.String |
getName()
Gets name of this User
|
(package private) boolean |
returnBook(int id)
User returns a Book
|
void |
setLimit(int limit)
Change limit of this User
|
void |
setName(java.lang.String name)
Change name of this User
|
boolean |
status()
Check status of the User
|
private java.util.List<java.lang.Integer> books
private int id
private int limit
private java.lang.String name
public User(java.lang.String name, int id, int limit)
name
- Name of this Userid
- id of this Userlimit
- Limit of Book this User can borrowpublic User(java.lang.String name, int id, int limit, java.util.ArrayList<java.lang.Integer> books)
name
- Name of this Userid
- id of this Userlimit
- Limit of Book this User can borrowbooks
- ArrayList of Book ids borrowed by the Userpublic int[] bookStatus()
boolean borrowNewBook(int id)
id
- id of the Book to tbe borrowedpublic int getId()
public int getLimit()
public java.lang.String getName()
boolean returnBook(int id)
id
- id of the Book to be returnedpublic void setLimit(int limit)
limit
- New limit of the Userpublic void setName(java.lang.String name)
name
- New name of the Userpublic boolean status()