PagedArray.cpp
/**
 * Gets a page, lods from disk if necesssary
 * @param page Int number of page
 * @return The page array pointer
 */
Gets a page, lods from disk if necesssary
@param page Int number of page
@return The page array pointer
Gets a page lods from disk if necesssary @param page Int number of page @return The page array pointer
int *PagedArray::getPage(int page) {
    int i;
    for (i = 0; i < NUMPAGES; i++) {
        if (loadedPages[i] == page) {
            lastAccessed = page;
            accessNumbers[i] += 1;
            return pageContainer[i];
        }
    }
    int whereToLoad = freePage();
    accessNumbers[whereToLoad] = 0;
    return loadPage(whereToLoad, page);
}
int * PagedArray :: getPage ( int page ) { int i ; for ( i = 0 ; i < NUMPAGES ; i ++ ) { if ( loadedPages [ i ] == page ) { lastAccessed = page ; accessNumbers [ i ] += 1 ; return pageContainer [ i ] ; } } int whereToLoad = freePage ( ) ; accessNumbers [ whereToLoad ] = 0 ; return loadPage ( whereToLoad , page ) ; }
Gets a page, lods from disk if necesssary
 @param page Int number of page
 @return The page array pointer
Gets a page lods from disk if necesssary @param page Int number of page @return The page array pointer
//printf ("Page %d is already on slot %d\n", page, i); //printf("LoadedPages: %d %d %d %d %d %d\n", loadedPages[0], loadedPages[1], loadedPages[2], loadedPages[3], loadedPages[4], loadedPages[5]); //printf("AccessedPages: %d %d %d %d %d %d\n", accessNumbers[0], accessNumbers[1], accessNumbers[2], accessNumbers[3], accessNumbers[4], accessNumbers[5]);