
//--------------------------------------------------------------------
// Class Cache
//
// Purpose  : handle class identity, and data content
//--------------------------------------------------------------------


public class Cache
{
	public int theMFTIndex;
	public long theLastModified;
	public int theBlockIndex; 
	public int theDataSize;
	public int theFileSize;
	public boolean endOfFile;

	public static int theCacheSize;
	public int theRefBit;
	public byte[] theCacheData;


//--------------------------------------------------------------------
// Contructor for Cache
//
// Input	: cacheSize (in Bytes)
// Output   : None
// Purpose  : initialize the cache parameters
//--------------------------------------------------------------------

	public Cache(int cacheSize)
	{
		theMFTIndex = -1;
		theLastModified = 0;
		theBlockIndex = 0;
		theDataSize = 0;
		theFileSize = 0;
		endOfFile = false;
		theRefBit = 0;
		theCacheSize = cacheSize;
		theCacheData = new byte[cacheSize];
	}


//--------------------------------------------------------------------
// Method isAvailable
//
// Input	: None
// Output   : flag true, if the cache is unoccupied
// Purpose  : check if this cache is available
//--------------------------------------------------------------------

	public boolean isAvailable ()
	{
		return (theMFTIndex == -1);
	}

	
//--------------------------------------------------------------------
// Method print
//
// Input	: None
// Output   : standard output print out cache identity
// Purpose  : print out the cache identity
//--------------------------------------------------------------------
	
	public void print ()
	{
		System.out.println("theFileName = " + theMFTIndex +
						   ",blockIndex = " + theBlockIndex +
						   ",theDataSize = " + theDataSize +
						   ",theRefBit = " + theRefBit + 
						   ",lastModified = " + theLastModified + 
						   ",theFileSize = " + theFileSize);
		return;
	}

}


//--------------------------------------------------------------------
// End Class Cache
//--------------------------------------------------------------------
