📄 pagination.java
字号:
package com.pet.toolkit;
/*
* 类Pagination是处理分页的工具
*/
public class Pagination {
private int pageSize;
private long totalPage;
private long totalResult;
private int currentPage;
public Pagination(int pageSize,long totalResult){
this.currentPage=1;
this.pageSize=pageSize;
this.totalResult=totalResult;
this.totalPage=(long)Math.ceil(totalResult/(double)pageSize);
}
public boolean hasNext(){
if(this.currentPage>=this.totalPage)
return false;
return true;
}
public boolean hasPrevious(){
if(this.currentPage<=1)
return false;
return true;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public long getTotalPage() {
return totalPage;
}
public void setTotalPage(long totalPage) {
this.totalPage = totalPage;
}
public long getTotalResult() {
return totalResult;
}
public void setTotalResult(long totalResult) {
this.totalResult = totalResult;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -