public final int partitionByName(int left, int  right) // used by sort by name
	{
		int max = logicalSize;
		Product pivotElement = products[left]; //Store the left most product as the object that all other objects will be tested against
		int lb = left, ub = right; // store imovable places which are used for the final move.
		Product temp;

		while (left < right)
		{
			while((products[left].getName().compareToIgnoreCase(pivotElement.getName()) <= 0) && left+1 < max) { // test the order of the products on left side
				left++;
			}
			while((products[right].getName().compareToIgnoreCase(pivotElement.getName()) > 0) && right -1 >= 0) { // test the order of the products on the right side
				right--;
			}
			if (left < right) // swap the left and right products
			{
				temp        = products[left];
				products[left]  = products[right];
				products[right] = temp;
			}
		}
		for(left = lb; left <= right && left +1 < max; left++) { //move the products one place to the left for all products after the pivot element
			products[left] = products[left +1];
		}
		products[right] = pivotElement; // move the pivot element to its place at right, where it is now in the correct order.
		return right; // return the new pivot (see quick sort)
	}