public synchronized void cacheOperation( int blockNumber, byte data[], CacheBlock.Task operation )
	{
		boolean exists = clock.blockExistsInCache( blockNumber );
		CacheBlock currentBlock = null;
		if( exists )
		{
			Library.output("Block " + blockNumber + " exists in Cache. \n" );
			currentBlock = clock.getCurrentBlock( );

			switch( operation )
			{
			case READ:
				currentBlock.readData( data );
				break;
			case WRITE:
				currentBlock.writeData( data );
				currentBlock.changeState( CacheBlock.State.DIRTY );
				clock.addCurrentBlock( currentBlock );
				break;
			}
		}
		else
		{
			currentBlock = clock.getNextBlock( );

			switch( operation )
			{
			case READ:
				diskQueue.read(blockNumber, data);
				currentBlock.useBlock(blockNumber, data);
				currentBlock.changeState( CacheBlock.State.CLEAN );
				currentBlock.changeRef( true );
				clock.addCurrentBlock( currentBlock );
				break;
			case WRITE:
				currentBlock.useBlock( blockNumber, data );
				currentBlock.changeState( CacheBlock.State.DIRTY );
				clock.addCurrentBlock( currentBlock );
				break;
			}
		}

	}