📄 cartbean.java
字号:
package beans;
import java.util.*;
import connector.Searcher;
public class CartBean {
private Searcher s = new Searcher();
private ArrayList<Book> books;
private ArrayList<Integer> amount;
private boolean toBuy;
public CartBean() {
books = new ArrayList<Book>();
amount = new ArrayList<Integer>();
toBuy = false;
}
public ArrayList<Book> getBooks() {
return books;
}
public ArrayList<Integer> getAmount() {
return amount;
}
public boolean isToBuy() {
return toBuy;
}
public void setBooks(ArrayList<Book> books) {
this.books = books;
}
public void setAmount(ArrayList<Integer> a) {
amount = a;
}
public void setToBuy(boolean buy) {
toBuy = buy;
}
public void addBooks(String bid) {
for (int i = 0; i < books.size(); i++) {
if (bid.equals(books.get(i).getBID())) {
amount.set(i, new Integer(amount.get(i).intValue()+1));
return;
}
}
books.add(s.getBookByID(bid));
amount.add(new Integer(1));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -