void
JTextUserNotification::ReportError
	(
	const JCharacter* message
	)
{
	if (!IsSilent())
		{
		cout << endl;
		cout << "Error: " << message;
		JWaitForReturn();
		}
}
void
JTextUserNotification::DisplayMessage
	(
	const JCharacter* message
	)
{
	if (!IsSilent())
		{
		cout << endl;
		cout << message;
		JWaitForReturn();
		}
}
int
main
	(
	int argc,
	char** argv
	)
{
	JInitCore();

	JChooseSaveFile* csf = JGetChooseSaveFile();

	JString resultStr;

	if (csf->ChooseFile("Name of file:", NULL, &resultStr))
		{
		std::cout << resultStr << std::endl;
		JWaitForReturn();
		}

	if (csf->ChooseFile("Name of file:", "Please select a file...", &resultStr))
		{
		std::cout << resultStr << std::endl;
		JWaitForReturn();
		}

	if (csf->ChooseRPath("", "Please select a directory...", NULL, &resultStr))
		{
		std::cout << resultStr << std::endl;
		JWaitForReturn();
		}

	if (csf->ChooseRWPath("", "Please select a writable directory:", NULL, &resultStr))
		{
		std::cout << resultStr << std::endl;
		JWaitForReturn();
		}

	if (csf->SaveFile("Save file as:", NULL, "junk", &resultStr))
		{
		std::cout << resultStr << std::endl;
		JWaitForReturn();
		}

	if (csf->SaveFile("Save file as:", "Please save the file...", "more junk", &resultStr))
		{
		std::cout << resultStr << std::endl;
		JWaitForReturn();
		}

	return 0;
}
int main()
{
	long i;

JQueue<long, JArray<long> > a1;									// constructor

	cout << "queue a1 created" << endl << endl;

	cout << "a1 itemCount should be 0" << endl;
	cout << "a1 itemCount = " << a1.GetElementCount() << endl << endl;

	for (i=1;i<=5;i++)
		{
		a1.Append(i);
		}

	cout << "a1 itemCount should be 5" << endl;
	cout << "a1 itemCount = " << a1.GetElementCount() << endl << endl;

	JWaitForReturn();

JQueue<long, JArray<long> > a2 = a1;							// copy constructor

	cout << "queue a2 created from a1" << endl << endl;

	cout << "a2 itemCount should be 5" << endl;
	cout << "a2 itemCount=" << a2.GetElementCount() << endl << endl;

	cout << "display should be:  1 2 3 4 5" << endl;

	while (!a1.IsEmpty())
		{
		i = a1.GetNext();
		cout << i << ' ';
		}
	cout << endl;

	cout << "a1 itemCount should be 0" << endl;
	cout << "a1 itemCount=" << a1.GetElementCount() << endl << endl;

	cout << "display should be:  1 2" << endl;

	do
		{
		i = a2.GetNext();
		cout << i << ' ';
		}
		while (i < 2);

	cout << endl;

	JWaitForReturn();

	cout << "display should be:  3" << endl;

	cout << a2.PeekNext() << endl;

	cout << "a2 itemCount should be 3" << endl;
	cout << "a2 itemCount=" << a2.GetElementCount() << endl << endl;

	a2.Discard(2);

	cout << "a2 itemCount should be 1" << endl;
	cout << "a2 itemCount=" << a2.GetElementCount() << endl << endl;

	a2.Flush();

	cout << "a2 itemCount should be 0" << endl;
	cout << "a2 itemCount=" << a2.GetElementCount() << endl << endl;

	return 0;
}
int main()
{
JLinkedList<long> a1;											// constructor

	std::cout << "linked list a1 created" << std::endl << std::endl;

JBroadcastSnooper snoop1(&a1);

	std::cout << "a1 address: " << (void*) &a1 << std::endl;

	std::cout << "a1 itemCount should be 0" << std::endl;
	std::cout << "a1 itemCount = " << a1.GetElementCount() << std::endl << std::endl;

	long i;
	for (i=1;i<=5;i++)
		{
		a1.AppendElement(i);
		}

	std::cout << "a1 itemCount should be 5" << std::endl;
	std::cout << "a1 itemCount = " << a1.GetElementCount() << std::endl << std::endl;

	JWaitForReturn();

	a1.MoveElementToIndex(1,3);
	a1.MoveElementToIndex(3,1);

	a1.SwapElements(2,5);

	a1.InsertElementAtIndex(3,1);

	a1.MoveElementToIndex(3,a1.GetElementCount());

JLinkedListIterator<long> iter(&a1, kJIteratorStartAtBeginning);

	std::cout << "display should be:  1 5 3 2 1" << std::endl;

	while (iter.Next(&i))
		{
		std::cout << i << ' ';

		if (i == 5) a1.RemoveElement(4);
		}
	std::cout << std::endl;

	std::cout << "display should be:  1 2 3 5 1" << std::endl;

	while (iter.Prev(&i))
		{
		std::cout << i << ' ';

		if (i == 5) a1.RemoveElement(4);
		}
	std::cout << std::endl;

	std::cout << "a1 itemCount should be 4" << std::endl;
	std::cout << "a1 itemCount = " << a1.GetElementCount() << std::endl << std::endl;

	JWaitForReturn();

JLinkedList<long> a2 = a1;										// copy constructor

	std::cout << "linked list a2 created from a1" << std::endl << std::endl;

JBroadcastSnooper snoop2(&a2);

	std::cout << "a2 address: " << (void*) &a2 << std::endl;

	std::cout << "a2 itemCount should be 4" << std::endl;
	std::cout << "a2 itemCount=" << a2.GetElementCount() << std::endl << std::endl;

JLinkedListIterator<long> iter2(&a2,kJIteratorStartAtEnd);

	std::cout << "display should be: 1 3 5 1" << std::endl;

	while (iter2.Prev(&i))
		{
		std::cout << i << ' ';
		}
	std::cout << std::endl;

	a2.RemoveAll();

	std::cout << "a2 itemCount should be 0" << std::endl;
	std::cout << "a2 itemCount=" << a2.GetElementCount() << std::endl << std::endl;

	a2 = a1;													// assignment operator

	std::cout << "linked list a2 assigned from a1" << std::endl << std::endl;

	std::cout << "a2 itemCount should be 4" << std::endl;
	std::cout << "a2 itemCount=" << a2.GetElementCount() << std::endl << std::endl;

	std::cout << "display should be: 1 3 5 1" << std::endl;

	iter2.MoveTo(kJIteratorStartAtEnd, 0);

	while (iter2.Prev(&i))
		{
		std::cout << i << ' ';
		}
	std::cout << std::endl;

	JWaitForReturn();

// test sort ascending

	a2.AppendElement(1);

	a2.SetCompareFunction(CompareLongs);
	a2.SetSortOrder(JOrderedSetT::kSortAscending);
	a2.Sort();

	std::cout << "display should be:" << std::endl;
	std::cout << "1 1 1 3 5" << std::endl;

	iter2.MoveTo(kJIteratorStartAtBeginning, 0);
	while (iter2.Next(&i))
		{
		std::cout << i << ' ';
		}
	std::cout << std::endl << std::endl;

// test insertion sort

	std::cout << "display should be: T F F F" << std::endl;
	{
	long element[] = {3, -1, 10, 4};
	const long eCount = sizeof(element)/sizeof(long);

	JBoolean isDuplicate;
	for (i=0; i<eCount; i++)
		{
		const JIndex j =
			a2.GetInsertionSortIndex(element[i], &isDuplicate);
		a2.InsertElementAtIndex(j, element[i]);
		std::cout << isDuplicate << ' ';
		}
	std::cout << std::endl << std::endl;
	}

// test binary search (sorted ascending)
// -1 1 1 1 3 3 4 5 10
	{
	long element[]   = {     2,     1,    -1,    10,     -3,     20};
	JBoolean found[] = {kJFalse, kJTrue, kJTrue, kJTrue, kJFalse, kJFalse};
	JIndex first[]   = {     0,     2,     1,     9,      0,      0};
	JIndex last[]    = {     0,     4,     1,     9,      0,      0};
	const long eCount = sizeof(element)/sizeof(long);
	assert( eCount == sizeof(found)/sizeof(JBoolean) );

	for (i=0; i<eCount; i++)
		{
		JIndex j;
		if (a2.SearchSorted(element[i], JOrderedSetT::kFirstMatch, &j) == found[i] &&
			j == first[i] &&
			a2.SearchSorted(element[i], JOrderedSetT::kLastMatch, &j) == found[i] &&
			j == last[i] &&
			a2.SearchSorted(element[i], JOrderedSetT::kAnyMatch, &j) == found[i] &&
			first[i] <= j && j <= last[i])
			{
			std::cout << i+1 << ": correct" << std::endl;
			}
		else
			{
			std::cout << i+1 << ": WRONG" << std::endl;
			}
		}
	}

	JWaitForReturn();

// test sort descending

	a2.SetSortOrder(JOrderedSetT::kSortDescending);
	a2.Sort();

	std::cout << "display should be:" << std::endl;
	std::cout << "10 5 4 3 3 1 1 1 -1" << std::endl;

	iter2.MoveTo(kJIteratorStartAtBeginning, 0);
	while (iter2.Next(&i))
		{
		std::cout << i << ' ';
		}
	std::cout << std::endl << std::endl;

// test binary search (sorted descending)
// 10 5 4 3 3 1 1 1 -1
	{
	long element[]   = {     2,     1,    -1,    10,     -3,     20};
	JBoolean found[] = {kJFalse, kJTrue, kJTrue, kJTrue, kJFalse, kJFalse};
	JIndex first[]   = {     0,     6,     9,     1,      0,      0};
	JIndex last[]    = {     0,     8,     9,     1,      0,      0};
	const long eCount = sizeof(element)/sizeof(long);
	assert( eCount == sizeof(found)/sizeof(JBoolean) );

	for (i=0; i<eCount; i++)
		{
		JIndex j;
		if (a2.SearchSorted(element[i], JOrderedSetT::kFirstMatch, &j) == found[i] &&
			j == first[i] &&
			a2.SearchSorted(element[i], JOrderedSetT::kLastMatch, &j) == found[i] &&
			j == last[i] &&
			a2.SearchSorted(element[i], JOrderedSetT::kAnyMatch, &j) == found[i] &&
			first[i] <= j && j <= last[i])
			{
			std::cout << i+1 << ": correct" << std::endl;
			}
		else
			{
			std::cout << i+1 << ": WRONG" << std::endl;
			}
		}
	}

	return 0;
}
Ejemplo n.º 6
0
int
main()
{
    JMatrix mx1(2,2),mx2(2,2);										// constructor

    cout << "mx1 is " << mx1.GetRowCount() << " x " << mx1.GetColCount() << endl;

    cout << "mx1 should be 0 0, 0 0" << endl;
    cout << "mx1 = " << mx1 << endl;

    mx1 = JIdentityMatrix(2);

    mx2.SetElement(1,1, 0.0);
    mx2.SetElement(1,2, 1.0);
    mx2.SetElement(2,1, 1.0);
    mx2.SetElement(2,2, 0.0);

    cout << "mx1 should be 1 0, 0 1" << endl;
    cout << "mx1 = " << mx1 << endl;

    cout << "mx2 should be 0 1, 1 0" << endl;
    cout << "mx2 = " << mx2 << endl;

    JWaitForReturn();

    JMatrix mx3 = -mx2;												// copy constructor

    cout << "mx3 should be 0 -1, -1 0" << endl;
    cout << "mx3 = " << mx3 << endl;

    mx3 += mx1;

    JMatrix mx4 = mx1 - mx2;

    cout << "mx4 should be 1 -1, -1 1" << endl;
    cout << "mx4 = " << mx4 << endl;

    cout << "mx3 should equal mx4" << endl;
    cout << "mx3 equals mx4? " << (mx3 == mx4) << endl;

    mx4 /= 0.5;

    cout << "mx4 should be 2 -2, -2 2" << endl;
    cout << "mx4 = " << mx4 << endl;

    mx4.SetAllElements(1.0);
    mx4.SetElement(1,2, 0.0);

    cout << "mx4 should be 1 0, 1 1" << endl;
    cout << "mx4 = " << mx4 << endl;

    JMatrix mx5 = mx4.Transpose();

    cout << "mx5 should be 1 1, 0 1" << endl;
    cout << "mx5 = " << mx5 << endl;

    cout << "mx4 * mx5 should be 1 1, 1 2" << endl;
    cout << "mx4 * mx5 = " << mx4 * mx5 << endl;

    JWaitForReturn();

    JVector v1 = mx4.GetColVector(2);
    JVector v2 = mx4.GetRowVector(1);

    cout << "v1 should be 0 1" << endl;
    cout << "v1 = " << v1 << endl;

    cout << "v1 dot v2 should be 0" << endl;
    cout << "v1 dot v2 = " << JDotProduct(v1, v2) << endl;

    cout << "mx4 * v1 should be 0, 1" << endl;
    cout << "mx4 * v1 = " << mx4 * v1 << endl;

    cout << "(v1)t * mx4 should be 1 1" << endl;
    cout << "(v1)t * mx4 = " << v1.Transpose() * mx4 << endl;

    cout << "Enter new mx5: ";
    cin >> mx5;
    JInputFinished();
    cout << "mx5 = " << mx5 << endl;

    JWaitForReturn();

    JMatrix mx6(3,3), mx7(3,3);

    mx6.SetElement(1,1, 1.0);
    mx6.SetElement(2,2, 2.0);
    mx6.SetElement(3,3, 3.0);

    cout << "det(mx6) should be 6" << endl;
    cout << "det(mx6) = " << mx6.Determinant() << endl;

    assert( mx6.Invert(&mx7) );
    cout << "mx7 should be 1 0 0, 0 0.5 0, 0 0 0.333333" << endl;
    cout << "mx7 = " << mx7 << endl;

    mx6.SetElement(1,1, 1.0);
    mx6.SetElement(1,2, 2.0);
    mx6.SetElement(1,3, 3.0);
    mx6.SetElement(2,1, 4.0);
    mx6.SetElement(2,2, 5.0);
    mx6.SetElement(2,3, 6.0);
    mx6.SetElement(3,1, 2.0);
    mx6.SetElement(3,2, 3.0);
    mx6.SetElement(3,3, 4.0);

    cout << endl;
    cout << "mx6 should be 1 2 3, 4 5 6, 2 3 4" << endl;
    cout << "mx6 = " << mx6 << endl;

    cout << "det(mx6) should be 0" << endl;
    cout << "det(mx6) = " << mx6.Determinant() << endl;

    assert( !mx6.Invert(&mx7) );

    cout << "mx6 was not invertible (correct)" << endl;

    mx6.SetElement(1,1, 1.0);
    mx6.SetElement(1,2, 0.5);
    mx6.SetElement(1,3, -2.0);
    mx6.SetElement(2,1, 1.0/3.0);
    mx6.SetElement(2,2, 5.0);
    mx6.SetElement(2,3, -7.5);
    mx6.SetElement(3,1, 0.0);
    mx6.SetElement(3,2, 1.0);
    mx6.SetElement(3,3, -3.0);

    cout << endl;
    assert( mx6.Invert(&mx7) );

    cout << "det(mx6) should be 1/det(mx7) should be -7.666667" << endl;
    cout << mx6.Determinant() << " ?= " << 1.0/mx7.Determinant() << endl;

    cout << "A*A-1 should get 1 0 0, 0 1 0, 0 0 1" << endl;
    cout << "A*A-1 = " << mx6 * mx7 << endl;
    cout << "A-1*A = " << mx7 * mx6 << endl;

    mx6.SetElement(1,1, 2.0);
    mx6.SetElement(1,2, -1.0);
    mx6.SetElement(1,3, 1.0);
    mx6.SetElement(2,1, 1.0);
    mx6.SetElement(2,2, 3.0);
    mx6.SetElement(2,3, 2.0);
    mx6.SetElement(3,1, 5.0);
    mx6.SetElement(3,2, 0.0);
    mx6.SetElement(3,3, -2.0);

    JVector b(3, 3.0, 13.0, -1.0);
    JVector x(3);

    cout << endl;
    cout << "Solution should be: 1 2 3" << endl;
    if (JGaussianElimination(mx6, b, &x))
    {
        cout << "Solution is:        " << x << endl;
    }
    else
    {
        cout << "ERROR: mx6 should be invertible!" << endl;
    }

    mx6.SetElement(3,1, 3.0);
    mx6.SetElement(3,2, 2.0);
    mx6.SetElement(3,3, 3.0);

    cout << endl;
    cout << "Solution should not exist" << endl;
    if (!JGaussianElimination(mx6, b, &x))
    {
        cout << "Solution does not exist" << endl;
    }
    else
    {
        cout << "Solution exists: " << x << endl;
        cout << "(because of round off error)" << endl;
    }

    return 0;
}
int main()
{
long i;

JSubset s1(10);													// constructor

	cout << "subset s1 created" << endl << endl;

	cout << "s1 itemCount should be 0" << endl;
	cout << "s1 itemCount = " << s1.GetElementCount() << endl << endl;

	s1.AddRange(3,4);
	s1.Add(9);

	cout << "s1 itemCount should be 3" << endl;
	cout << "s1 itemCount = " << s1.GetElementCount() << endl << endl;

	cout << "s1 should contain:         10FFTTFFFFTF" << endl;
	cout << "s1 contains      : " << s1 << endl;
	cout << "using Contains() :           ";

	for (i=1; i<=10; i++)
		{
		cout << s1.Contains(i);
		}
	cout << endl;

JSubset s2 = s1;

	cout << endl;
	cout << "subset s2 created" << endl << endl;

	s2.Remove(1);

	cout << "s1 should equal s2" << endl;
	cout << "s1 equals s2? " << (s1 == s2) << endl;

	s2.Remove(4);
	s2.Add(2);

	cout << "s2 should contain:         10FTTFFFFFTF" << endl;
	cout << "s2 contains      : " << s2 << endl;

	cout << "s1 should not equal s2" << endl;
	cout << "s1 equals s2? " << (s1 == s2) << endl;

	JWaitForReturn();

JSubset s3 = s1 + s2;
JSubset s4 = s1 - s2;
JSubset s5 = s2 - s1;
JSubset s7 = JIntersection(s4, s5);

	cout << "s3 should contain:         10FTTTFFFFTF" << endl;
	cout << "s3 contains      : " << s3 << endl << endl;

	cout << "s4 should contain:         10FFFTFFFFFF" << endl;
	cout << "s4 contains      : " << s4 << endl << endl;

	cout << "s5 should contain:         10FTFFFFFFFF" << endl;
	cout << "s5 contains      : " << s5 << endl << endl;

	cout << "s7 should contain:         10FFFTFFFFFF" << endl;
	cout << "s7 contains      : " << s4 << endl << endl;

	JWaitForReturn();

	s3.RemoveAll();
	s3.AddRange(3,8);
	s3.RemoveRange(4,6);

	cout << "s3 should contain:         10FFTFFFTTFF" << endl;
	cout << "s3 contains      : " << s3 << endl << endl;

JSubsetIterator iter = s3.NewIterator();

	JIndex index;

	cout << "s3 contains: ";
	while (iter.Next(&index))
		{
		cout << ' ' << index;
		}
	cout << endl << endl;

JSubset s6 = s3.Complement();

	cout << "s6 should contain:         10TTFTTTFFTT" << endl;
	cout << "s6 contains      : " << s6 << endl << endl;

	s6 = s3;											// assignment operator

	cout << "s6 assigned from s3" << endl << endl;

	cout << "s6 itemCount should be 3" << endl;
	cout << "s6 itemCount=" << s6.GetElementCount() << endl << endl;

	cout << "s6 should contain:         10FFTFFFTTFF" << endl;
	cout << "s6 contains      : " << s6 << endl << endl;

	JWaitForReturn();

	cout << "Twenty random samples of size 3:" << endl << endl;

	for (i=1; i<=20; i++)
		{
		if (JGetRandomSample(&s1, 3))
			{
			assert( s1.GetElementCount() == 3 );
			cout << s1 << endl;
			}
		else
			{
			cerr << "Unable to generate random subset of that size." << endl;
			}
		}

// JGetRandomSample()

	JHistogram<JSize> h(10);
	for (i=1; i<=5000; i++)
		{
		JGetRandomSample(&s3, 3, 2,8);

		iter.MoveTo(kJIteratorStartAtBeginning, 0);
		while (iter.Next(&index))
			{
			h.IncrementCount(index, 1);
			}
		}

	JProbDistr p = h.ConvertToProbabilities();

	cout << endl;
	cout << "Probability of each element (2-8) being in the subset:" << endl;
	cout << "(averaged over ensemble of 5000 subsets)" << endl << endl;
	cout << p << endl;

// JSubset::GetRandomSample()

	JBoolean ok = JGetRandomSample(&s1, 7);
	assert( ok );

	h.Clear();
	for (i=1; i<=5000; i++)
		{
		s1.GetRandomSample(&s3, 3);

		iter.MoveTo(kJIteratorStartAtBeginning, 0);
		while (iter.Next(&index))
			{
			h.IncrementCount(index, 1);
			}
		}

	p = h.ConvertToProbabilities();

	cout << endl;
	cout << "Probability of each element (sample of 7) being in the subset:" << endl;
	cout << "(averaged over ensemble of 5000 subsets)" << endl << endl;
	cout << p << endl;

// JSubset::GetRandomDisjointSamples()

	JPtrArray<JSubset> sampleList(JPtrArrayT::kDeleteAll);

	JArray<JSize> sampleSizeList;
	sampleSizeList.AppendElement(2);
	sampleSizeList.AppendElement(2);

	JHistogram<JSize> h1(10), h2(10);
	JHistogram<JSize>* hist[] = { &h1, &h2 };
	for (i=1; i<=5000; i++)
		{
		s1.GetRandomDisjointSamples(&sampleList, sampleSizeList);

		for (JIndex j=1; j<=2; j++)
			{
			JSubsetIterator iter = (sampleList.NthElement(j))->NewIterator();
			while (iter.Next(&index))
				{
				hist[j-1]->IncrementCount(index, 1);
				assert( !(sampleList.NthElement(3-j))->Contains(index) );
				}
			}
		}

	cout << endl;
	cout << "Probability of each element (2 from sample of 7) being in the subset:" << endl;
	cout << "(averaged over ensemble of 5000 subsets)" << endl << endl;
	cout << "1) " << h1.ConvertToProbabilities() << endl;
	cout << "2) " << h2.ConvertToProbabilities() << endl;

// JSubset::GetRandomDisjointSamples() -- partitioning

	sampleSizeList.SetElement(1, 3);
	sampleSizeList.SetElement(2, 4);

	h1.Clear();
	h2.Clear();
	for (i=1; i<=5000; i++)
		{
		s1.GetRandomDisjointSamples(&sampleList, sampleSizeList);

		for (JIndex j=1; j<=2; j++)
			{
			JSubsetIterator iter = (sampleList.NthElement(j))->NewIterator();
			while (iter.Next(&index))
				{
				hist[j-1]->IncrementCount(index, 1);
				assert( !(sampleList.NthElement(3-j))->Contains(index) );
				}
			}
		}
	sampleList.DeleteAll();

	cout << endl;
	cout << "Probability of each element (3,4 from sample of 7) being in the subset:" << endl;
	cout << "(averaged over ensemble of 5000 subsets)" << endl << endl;
	cout << "1) " << h1.ConvertToProbabilities() << endl;
	cout << "2) " << h2.ConvertToProbabilities() << endl;

	return 0;
}
int main()
{
	long i;

JStack<long, JArray<long> > a1;									// constructor

	cout << "stack a1 created" << endl << endl;

	cout << "a1 itemCount should be 0" << endl;
	cout << "a1 itemCount = " << a1.GetElementCount() << endl << endl;

	for (i=1;i<=5;i++)
		{
		a1.Push(i);
		}

	cout << "a1 itemCount should be 5" << endl;
	cout << "a1 itemCount = " << a1.GetElementCount() << endl << endl;

	JWaitForReturn();

JStack<long, JArray<long> > a2 = a1;							// copy constructor

	cout << "stack a2 created from a1" << endl << endl;

	cout << "a2 itemCount should be 5" << endl;
	cout << "a2 itemCount=" << a2.GetElementCount() << endl << endl;

	cout << "display should be:  5 4 3 2 1" << endl;

	while (!a1.IsEmpty())
		{
		i = a1.Pop();
		cout << i << ' ';
		}
	cout << endl;

	cout << "a1 itemCount should be 0" << endl;
	cout << "a1 itemCount=" << a1.GetElementCount() << endl << endl;

	cout << "display should be:  5 4" << endl;

	do
		{
		i = a2.Pop();
		cout << i << ' ';
		}
		while (i > 4);

	cout << endl;

	cout << "a2 itemCount should be 3" << endl;
	cout << "a2 itemCount=" << a2.GetElementCount() << endl << endl;

	a2.Unwind(2);

	cout << "a2 itemCount should be 1" << endl;
	cout << "a2 itemCount=" << a2.GetElementCount() << endl << endl;

	a2.Clear();

	cout << "a2 itemCount should be 0" << endl;
	cout << "a2 itemCount=" << a2.GetElementCount() << endl << endl;

	return 0;
}