/* Descriptor for QuickSort Application of Scala Divide-and-Comquer Framework
   H. Conrad Cunningham
   Version #1:  30 March 2010

   This is a Scala adaptation of a part of the Java Quicksort
   application of the Divide-and-Conquer Framework.  It describes the
   Problems and Solutions for both the Template-based and
   Strategy-based applications.  This framework is described in the
   paper:

     H. C. Cunningham, Y. Liu, and C. Zhang. "Using Classic Problems
     to Teach Java Framework Design," _Science of Computer
     Programming_, Special Issue on Principles and Practice of
     Programming in Java (PPPJ 2004), Vol. 59, No. 1-2, pp. 147-169,
     January 2006. doi: 10.10.16/j.scico.2005.07.009.

   This Scala version uses generics to give more generality to the
   clients and to avoid casting.  (The old Java version did not use
   generics.)

123456789012345678901234567890123456789012345678901234567890123456789012345678

*/

/* Class QuickSortDesc objects encapsulate the whole array to be
   sorted and the beginning and ending indices for the segment denoted
   by this descriptor.  The generic parameter is the type of the
   elements to be sorted.  These must be from a total ordered type,
   that is, be a class that either extends Ordered or has a defined
   conversion to something else that does.
*/

class QuickSortDesc[T <% Ordered[T]] (arr: Array[T], first: Int, last: Int) 
    extends Problem with Solution {
  def getArr: Array[T] = arr
  def getFirst: Int    = first
  def getLast: Int     = last
}
