Pagect.java-Paging class
/*
@version ***********
Created on June 25, 2001, 14:41
**************************************
*/
Package VOD;
Import java.sql.*;
Import java.util.*;
public class Pagect
{
Private long L_start; Start recording
Private long l_end; End record
Private long l_curpage; Current page
Private long l_totalnum;//total record number
private int int_num=5; 10 Records per page
Private long l_totalpage; Total number of pages
public void Init (Long currentpage,long totalnum)
{
L_curpage = CurrentPage;
L_totalnum = Totalnum;
if (currentpage>=0)
{
if (currentpage>= (long) Math.ceil (double) l_totalnum/(double) int_num)
L_curpage = (long) Math.floor (double) l_totalnum/(double) int_num);
Else
L_curpage = CurrentPage;
}
Else
{
l_curpage = 0;
}
L_start = L_curpage * INT_NUM;
L_end = L_start + int_num;
if (L_end > L_totalnum)
L_end = L_totalnum;
L_totalpage = (long) Math.ceil (double) l_totalnum/(double) int_num);
}
Public long Getcurpage ()
{
return l_curpage;
}
Public long Getprepage ()
{
if (l_curpage-1>=0)
{
return l_curpage-1;
}
Else
{
return 0;
}
}
Public long Getnextpage ()
{
if (l_curpage+1<=l_totalpage)
{
return l_curpage+1;
}
Else
{
return l_totalpage;
}
}
Public long Gettotalnum ()
{
return l_totalnum;
}
Public long Gettotalpage ()
{
return l_totalpage;
}
Public long Getstart ()
{
return l_start;
}
Public long Getend ()
{
return l_end;
}