TestFloatTable::TestFloatTable
	(
	JFloatTableData*	data,
	JXMenuBar*			menuBar,
	JXScrollbarSet*		scrollbarSet,
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXFloatTable(data, 4, scrollbarSet, enclosure,
				 hSizing,vSizing, x,y, w,h)
{
JIndex i,j;

	itsMouseAction = kInsertCol;

	(GetEditMenuHandler())->AppendEditMenu(menuBar);

	itsTableMenu = menuBar->AppendTextMenu(kTableMenuTitleStr);
	itsTableMenu->SetMenuItems(kTableMenuStr);
	itsTableMenu->SetUpdateAction(JXMenu::kDisableNone);
	ListenTo(itsTableMenu);

	itsSizeMenu = new JXFontSizeMenu(JGetDefaultFontName(), "Size", menuBar,
									 kFixedLeft, kFixedTop, 0,0, 10,10);
	assert( itsSizeMenu != NULL );
	menuBar->AppendMenu(itsSizeMenu);
	ListenTo(itsSizeMenu);

	itsStyleMenu =
		new JXStyleTableMenu(this, menuBar,
							 kFixedLeft, kFixedTop, 0,0, 10,10);
	assert( itsStyleMenu != NULL );
	menuBar->AppendMenu(itsStyleMenu);

	JSize fontSize;
	const JString& fontName = GetFont(&fontSize);
	itsSizeMenu->SetFontName(fontName);
	itsSizeMenu->SetFontSize(fontSize);

	data->AppendRows(kInitRowCount);
	data->AppendCols(kInitColCount);

	JKLRand r;
	for (j=1; j<=kInitColCount; j++)
		{
		for (i=1; i<=kInitRowCount; i++)
			{
			data->SetElement(i,j, r.UniformClosedProb());
			}
		}
}
int
main()
{
	cout << "Beginning JHashTable test.  No news is good news" << endl;

//	TableState experiment = CreateTableState;

	JHashTable< JStrValue<int> > table;

	// Generate hash list
	JHashValue hashList[kElementNum];
	JIndex i;
	for (i=0;i<kElementNum;i++)
		{
		hashList[i] = gRand.UniformInt32();
		}

	// Generate key list
	const JCharacter* keyList[kElementNum];
	for (i=0;i<kElementNum;i++)
		{
		keyList[i] = "Lazy key";
		}

	// Generate value list
	JStrValue<int> valueList[kElementNum];
	for (i=0;i<kElementNum;i++)
		{
		valueList[i].key =   "Lazy key";
		valueList[i].value =  gRand.UniformInt32();
		}

	// Generate storage count list
	int countList[kElementNum];
	for (i=0;i<kElementNum;i++)
		{
		countList[i] = 0;
		}

//	JSize goal = 100;
	for (i=0;i<10000;i++)
		{
		JFloat prob = gRand.UniformClosedProb();
		if (prob < 0.1)
			{
			StoreRand(&table, kElementNum, hashList, valueList, countList);
			}
		else if (prob < 0.2)
			{
			RemoveRand(&table, kElementNum, hashList, valueList, countList);
			}
		else
			{
			SearchRand(&table, kElementNum, hashList, valueList, countList);
			}
		}

//cout << "\nSecond half\n" << endl;

	for (i=0;i<10000;i++)
		{
		JFloat prob = gRand.UniformClosedProb();
		if (prob < 0.05)
			{
			StoreRand(&table, kElementNum, hashList, valueList, countList);
			}
		else if (prob < 0.15)
			{
			RemoveRand(&table, kElementNum, hashList, valueList, countList);
			}
		else
			{
			SearchRand(&table, kElementNum, hashList, valueList, countList);
			}
		}

	cout << "Finished JHashTable test.  If nothing printed out, it passed" << endl;

	cout << "\n         Size: " << table.GetTableSize() << endl;

	cout << "\nElement count: " << table.GetElementCount() << endl;
	cout <<   "   Load count: " << table.GetLoadCount() << endl;

	cout << "\nFill factor: " << table.GetFillFactor() << endl;
	cout <<   "Load factor: " << table.GetLoadFactor() << endl;

	return 0;
}