📄 findbooksbeans.java
字号:
package funcBeans;
import beans.Book;
import java.util.*;
import connector.Searcher;;
public class FindBooksBeans {
private Searcher s = new Searcher();
private String method;
private String context;
private ArrayList<Book> books;
public FindBooksBeans() {
method = null;
context = null;
books = new ArrayList<Book>();
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getContext() {
return context;
}
public void setContext(String context) {
this.context = context;
}
public ArrayList<Book> getBooks() {
if (method == null)
return null;
if (method.trim().equals("title"))
books = s.searchBookByTitle(context);
else if(method.trim().equals("author"))
books = s.searchBookByAuthor(context);
System.err.println(books);
return books;
}
public void setBooks(ArrayList<Book> books) {
this.books = books;
}
public Book getBookById(String bid) {
return s.getBookByID(bid);
}
public double getDiscount(String bid) {
return 0.8; // something important should be done here
}
public ArrayList<Book> top10BySale() {
return s.top10BySale();
}
public ArrayList<Book> top10ByDate() {
return s.top10ByDate();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -