import java.io.*; import java.util.*; /***************************************************************************
JSortItem
This object is the Java equivalent to a pointer to a sort item in a memory page.
Development Environment
Compiled under JDK 1.2.0, Jini 1.0.0
***************************************************************************/
public class JSortItem
{
/** Real page number (0 based). *//*
================================ */
int iRealPageNumber;
/** Byte offset of the beginning of the item. *//*
============================================== */
int iItemOffset;
/*=========================================================================
The following methods are in alphabetical order
=========================================================================*/
/* G E T I T E M
*/
/** This method assumes that the virtual page that contains the
* requested item is already in memory. This method then stores
* the real page number and the byte offset of the item in this
* object's instance variables.
*
* @param jobIn - the job that contains the real and virtual page arrays.
* @param lItemNumberIn - the requested sort item number.
*
*/
public void getItem (JSortJob jobIn, long lItemNumberIn)
{
int iItemVPage; /* Virtual page num that holds item. */
/* Calculate the virtual page number for the requested item.
========================================================= */
iItemVPage = (short) (lItemNumberIn / jobIn.items_pr_page);
/* Pick the real page slot that holds the item's virtual page
and store it in the instance variable.
=========================================================== */
for
(
iRealPageNumber = 0;
jobIn.vpage_num[iRealPageNumber] != iItemVPage;
iRealPageNumber++
);
/* Calculate the byte offset of the first byte in the item and
store it in the instance variable.
=========================================================== */
iItemOffset = (int) (lItemNumberIn % jobIn.items_pr_page)
* jobIn.itemlgth;
}
/* T O S T R I N G
*/
/**
*/
public String toString ()
{
String s;
s = "