/* EmployeeSorter Application of InsertionSorter Framework
   H. Conrad Cunningham
   Version #1:  28 March 2010
   Version #1a: 30 March 2010

   This is relatively straightforward Scala translation of the C++
   concrete class EmployeeSorter from section 21.1.1 of Timothy Budd's
   _An Introduction to Object-Oriented Programming_, Third Edition.

   This class mixes in the InsertionSorter trait, a base class for the
   Template Method design pattern.  This class gives concrete
   definitions for the hook methods.

123456789012345678901234567890123456789012345678901234567890123456789012345678

*/

class EmployeeSorter(data: Array[Employee], sze: Int) 
  extends InsertionSorter {

 // Define the hook methods
 def swap(i: Int, j: Int) {
    val temp = data(i)
    data(i)  = data(j)
    data(j)  = temp
  }

  def size = sze

  def lessThan(i: Int, j: Int) =  data(i).startingYear < data(j).startingYear

}
