pageresult
1464 ワード
package util;
public class PageResult {
int sizeOfPage=3;// , 3
int numOfRecords;//
int numOfPage;//
int currentPage=1;// ,
int numOfRecordForStarting;//
public int getSizeOfPage() {
return (sizeOfPage<1)?3:sizeOfPage;
}
public void setSizeOfPage(int sizeOfPage) {
this.sizeOfPage = sizeOfPage;
}
public int getNumOfRecords() {
return numOfRecords;
}
public void setNumOfRecords(int numOfRecords) {
this.numOfRecords = numOfRecords;
}
public int getNumOfPage() {
int nop = (this.getNumOfRecords()-1)/this.getSizeOfPage()+1;
return nop;
}
public void setNumOfPage(int numOfPage) {
this.numOfPage = numOfPage;
}
public int getCurrentPage() {
// 1 1
int cp = (currentPage<1)?1:currentPage;
// ,
if (cp>=this.getNumOfPage()) {
cp=this.getNumOfPage();
}
return cp;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getNumOfRecordForStarting() {
int num=(this.getCurrentPage()-1)*this.getSizeOfPage();
int nrfs=(num<1)?0:num;
return nrfs;
}
public void setNumOfRecordForStarting(int numOfRecordForStarting) {
this.numOfRecordForStarting = numOfRecordForStarting;
}
}