package pojo;
import java.io.Serializable;
public class Book implements Comparable<Book>, Serializable{
private int num; //编号
private String title; //书名
private String author; //作者
private boolean borrow = true; //是否可借阅
private int time; //借阅次数
public Book() {
}
public Book(int num, String title, String author, int time) {
super();
this.num = num;
this.title = title;
this.author = author;
this.borrow = borrow;
this.time = time;
}
public Book(int num, String title, String author) {
super();
this.num = num;
this.title = title;
this.author = author;
this.borrow = borrow;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public boolean isBorrow() {
return borrow;
}
public void setBorrow(boolean borrow) {
this.borrow = borrow;
}
public int getTime() {
return time;
}
public void setTime(int time) {
this.time = time;
}
@Override
public int compareTo(Book b) {
// TODO Auto-generated method stub
if(this.time > b.time){
return -1;
}else if(this.time < b.time){
return 1;
}
return 0;
}
}